dolibarr 21.0.0-beta
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 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';
33require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
34require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
36
45// Load translation files required by the page
46$langs->load("companies");
47
48
49// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
50$hookmanager = new HookManager($db);
51$hookmanager->initHooks(array('thirdpartiesindex'));
52
53
54$socid = GETPOSTINT('socid');
55if ($user->socid) {
56 $socid = $user->socid;
57}
58
59// Security check
60$result = restrictedArea($user, 'societe|contact', 0, '', '', '', '');
61
62$thirdparty_static = new Societe($db);
63$contact_static = new Contact($db);
64
65if (!isset($form) || !is_object($form)) {
66 $form = new Form($db);
67}
68
69// Load $resultboxes
70$resultboxes = FormOther::getBoxesArea($user, "3");
71
72if (GETPOST('addbox')) {
73 // Add box (when submit is done from a form when ajax disabled)
74 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
75 $zone = GETPOSTINT('areacode');
76 $userid = GETPOSTINT('userid');
77 $boxorder = GETPOST('boxorder', 'aZ09');
78 $boxorder .= GETPOST('boxcombo', 'aZ09');
79 $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
80 if ($result > 0) {
81 setEventMessages($langs->trans("BoxAdded"), null);
82 }
83}
84
85$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
86
87
88/*
89 * View
90 */
91
92$transAreaType = $langs->trans("ThirdPartiesArea");
93$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Terceros';
94
95llxHeader("", $langs->trans("ThirdParties"), $helpurl);
96
97print load_fiche_titre($transAreaType, $resultboxes['selectboxlist'], 'companies');
98
99
100// Statistics area
101
102$third = array(
103 'customer' => 0,
104 'prospect' => 0,
105 'supplier' => 0,
106 'other' =>0
107);
108$total = 0;
109
110$sql = "SELECT s.rowid, s.client, s.fournisseur";
111$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
112if (!$user->hasRight('societe', 'client', 'voir')) {
113 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
114}
115$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
116if (!$user->hasRight('societe', 'client', 'voir')) {
117 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
118}
119if (!$user->hasRight('fournisseur', 'lire')) {
120 $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
121}
122// Add where from hooks
123$parameters = array('socid' => $socid);
124$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
125if (empty($reshook)) {
126 if ($socid > 0) {
127 $sql .= " AND s.rowid = ".((int) $socid);
128 }
129}
130$sql .= $hookmanager->resPrint;
131//print $sql;
132$result = $db->query($sql);
133if ($result) {
134 while ($objp = $db->fetch_object($result)) {
135 $found = 0;
136 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS') && ($objp->client == 2 || $objp->client == 3)) {
137 $found = 1;
138 $third['prospect']++;
139 }
140 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS') && ($objp->client == 1 || $objp->client == 3)) {
141 $found = 1;
142 $third['customer']++;
143 }
144 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) {
145 $found = 1;
146 $third['supplier']++;
147 }
148 if (isModEnabled('societe') && $objp->client == 0 && $objp->fournisseur == 0) {
149 $found = 1;
150 $third['other']++;
151 }
152 if ($found) {
153 $total++;
154 }
155 }
156} else {
157 dol_print_error($db);
158}
159
160$thirdpartygraph = '<div class="div-table-responsive-no-min">';
161$thirdpartygraph .= '<table class="noborder nohover centpercent">'."\n";
162$thirdpartygraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
163if (!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)) {
164 $thirdpartygraph .= '<tr><td class="center" colspan="2">';
165 $dataseries = array();
166 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
167 $dataseries[] = array($langs->transnoentitiesnoconv("Prospects"), round($third['prospect']));
168 }
169 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
170 $dataseries[] = array($langs->transnoentitiesnoconv("Customers"), round($third['customer']));
171 }
172 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')) {
173 $dataseries[] = array($langs->transnoentitiesnoconv("Suppliers"), round($third['supplier']));
174 }
175 if (isModEnabled('societe')) {
176 $dataseries[] = array($langs->transnoentitiesnoconv("Others"), round($third['other']));
177 }
178 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
179 $dolgraph = new DolGraph();
180 $dolgraph->SetData($dataseries);
181 $dolgraph->setShowLegend(2);
182 $dolgraph->setShowPercent(1);
183 $dolgraph->SetType(array('pie'));
184 $dolgraph->setHeight('200');
185 $dolgraph->draw('idgraphthirdparties');
186 $thirdpartygraph .= $dolgraph->show();
187 $thirdpartygraph .= '</td></tr>'."\n";
188} else {
189 $statstring = '';
190 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
191 $statstring .= "<tr>";
192 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
193 $statstring .= "</tr>";
194 }
195 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
196 $statstring .= "<tr>";
197 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
198 $statstring .= "</tr>";
199 }
200 $statstring2 = '';
201 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')) {
202 $statstring2 .= "<tr>";
203 $statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
204 $statstring2 .= "</tr>";
205 }
206 $thirdpartygraph .= $statstring;
207 $thirdpartygraph .= $statstring2;
208}
209$thirdpartygraph .= '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td class="right">';
210$thirdpartygraph .= $total;
211$thirdpartygraph .= '</td></tr>';
212$thirdpartygraph .= '</table>';
213$thirdpartygraph .= '</div>';
214
215$thirdpartycateggraph = '';
216if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES')) {
217 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
218
219 $thirdpartycateggraph = '<div class="div-table-responsive-no-min">';
220 $thirdpartycateggraph .= '<table class="noborder nohover centpercent">';
221 $thirdpartycateggraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
222 $thirdpartycateggraph .= '<tr><td class="center" colspan="2">';
223 $sql = "SELECT c.label, count(*) as nb";
224 $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
225 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
226 $sql .= " WHERE c.type = 2";
227 if (!is_numeric(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))) {
228 $sql .= " AND c.label like '".$db->escape(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))."'";
229 }
230 $sql .= " AND c.entity IN (".getEntity('category').")";
231 $sql .= " GROUP BY c.label";
232 $total = 0;
233 $result = $db->query($sql);
234 if ($result) {
235 $num = $db->num_rows($result);
236 $i = 0;
237 if (!empty($conf->use_javascript_ajax)) {
238 $dataseries = array();
239 $rest = 0;
240 $nbmax = 10;
241
242 while ($i < $num) {
243 $obj = $db->fetch_object($result);
244 if ($i < $nbmax) {
245 $dataseries[] = array($obj->label, round($obj->nb));
246 } else {
247 $rest += $obj->nb;
248 }
249 $total += $obj->nb;
250 $i++;
251 }
252 if ($i > $nbmax) {
253 $dataseries[] = array($langs->trans("Other"), round($rest));
254 }
255 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
256 $dolgraph = new DolGraph();
257 $dolgraph->SetData($dataseries);
258 $dolgraph->setShowLegend(2);
259 $dolgraph->setShowPercent(1);
260 $dolgraph->SetType(array('pie'));
261 $dolgraph->setHeight('200');
262 $dolgraph->draw('idgraphcateg');
263 $thirdpartycateggraph .= $dolgraph->show();
264 } else {
265 while ($i < $num) {
266 $obj = $db->fetch_object($result);
267
268 $thirdpartycateggraph .= '<tr class="oddeven"><td>'.dolPrintHTML($obj->label).'</td><td>'.$obj->nb.'</td></tr>';
269 $total += $obj->nb;
270 $i++;
271 }
272 }
273 }
274 $thirdpartycateggraph .= '</td></tr>';
275 $thirdpartycateggraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
276 $thirdpartycateggraph .= $total;
277 $thirdpartycateggraph .= '</td></tr>';
278 $thirdpartycateggraph .= '</table>';
279 $thirdpartycateggraph .= '</div>';
280} else {
281 $thirdpartycateggraph = '';
282}
283
284
285/*
286 * Latest modified third parties
287 */
288
289$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
290$sql .= ", s.code_client";
291$sql .= ", s.code_fournisseur";
292if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
293 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
294 $sql .= ", spe.accountancy_code_customer as code_compta";
295} else {
296 $sql .= ", s.code_compta_fournisseur";
297 $sql .= ", s.code_compta";
298}
299$sql .= ", s.logo";
300$sql .= ", s.entity";
301$sql .= ", s.canvas, s.tms as date_modification, s.status as status";
302$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
303if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
304 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
305}
306// TODO Replace this
307if (!$user->hasRight('societe', 'client', 'voir')) {
308 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
309}
310$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
311if (!$user->hasRight('societe', 'client', 'voir')) {
312 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
313}
314if (!$user->hasRight('fournisseur', 'lire')) {
315 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
316}
317// Add where from hooks
318$parameters = array('socid' => $socid);
319$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
320if (empty($reshook)) {
321 if ($socid > 0) {
322 $sql .= " AND s.rowid = ".((int) $socid);
323 }
324}
325$sql .= $hookmanager->resPrint;
326$sql .= $db->order("s.tms", "DESC");
327$sql .= $db->plimit($max, 0);
328
329//print $sql;
330$lastmodified="";
331$result = $db->query($sql);
332if ($result) {
333 $num = $db->num_rows($result);
334
335 $i = 0;
336
337 if ($num > 0) {
338 $transRecordedType = $langs->trans("LastModifiedThirdParties", $max);
339
340 $lastmodified = "\n<!-- last thirdparties modified -->\n";
341 $lastmodified .= '<div class="div-table-responsive-no-min">';
342 $lastmodified .= '<table class="noborder centpercent">';
343
344 $lastmodified .= '<tr class="liste_titre"><th colspan="2">';
345 //$lastmodified .= img_picto('', 'company', 'class="pictofixedwidth"');
346 $lastmodified .= '<span class="valignmiddle">'.$transRecordedType.'</span>';
347 $lastmodified .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
348 $lastmodified .= '<span class="badge marginleftonlyshort">...</span>';
349 $lastmodified .= '</a>';
350 $lastmodified .= '</th>';
351 $lastmodified .= '<th>&nbsp;</th>';
352 $lastmodified .= '<th class="right">';
353 $lastmodified .= '</th>';
354 $lastmodified .= '</tr>'."\n";
355
356 while ($i < $num) {
357 $objp = $db->fetch_object($result);
358
359 $thirdparty_static->id = $objp->rowid;
360 $thirdparty_static->name = $objp->name;
361 $thirdparty_static->client = $objp->client;
362 $thirdparty_static->fournisseur = $objp->fournisseur;
363 $thirdparty_static->logo = $objp->logo;
364 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
365 $thirdparty_static->status = $objp->status;
366 $thirdparty_static->code_client = $objp->code_client;
367 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
368 $thirdparty_static->canvas = $objp->canvas;
369 $thirdparty_static->email = $objp->email;
370 $thirdparty_static->entity = $objp->entity;
371 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
372 $thirdparty_static->code_compta_client = $objp->code_compta;
373
374 $lastmodified .= '<tr class="oddeven">';
375 // Name
376 $lastmodified .= '<td class="nowrap tdoverflowmax200">';
377 $lastmodified .= $thirdparty_static->getNomUrl(1);
378 $lastmodified .= "</td>\n";
379 // Type
380 $lastmodified .= '<td class="center">';
381 $lastmodified .= $thirdparty_static->getTypeUrl();
382 $lastmodified .= '</td>';
383 // Last modified date
384 $lastmodified .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
385 $lastmodified .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
386 $lastmodified .= "</td>";
387 $lastmodified .= '<td class="right nowrap">';
388 $lastmodified .= $thirdparty_static->getLibStatut(3);
389 $lastmodified .= "</td>";
390 $lastmodified .= "</tr>\n";
391 $i++;
392 }
393
394 $db->free($result);
395
396 $lastmodified .= "</table>\n";
397 $lastmodified .= '</div>';
398 $lastmodified .= "<!-- End last thirdparties modified -->\n";
399 }
400} else {
401 dol_print_error($db);
402}
403
404
405
406/*
407 * Latest modified contacts
408 */
409$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
410$sql .= ", s.code_client";
411$sql .= ", s.code_fournisseur";
412if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
413 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
414 $sql .= ", spe.accountancy_code_customer as code_compta";
415} else {
416 $sql .= ", s.code_compta_fournisseur";
417 $sql .= ", s.code_compta";
418}
419$sql .= ", s.logo";
420$sql .= ", s.entity";
421$sql .= ", s.canvas";
422$sql .= ", s.tms as date_modification, s.status as status";
423$sql .= ", sp.rowid as cid, sp.canvas as ccanvas, sp.email as cemail, sp.firstname, sp.lastname";
424$sql .= ", sp.address as caddress, sp.phone as cphone";
425$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as sp";
426if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
427 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
428}
429// TODO Replace this
430if (!$user->hasRight('societe', 'client', 'voir')) {
431 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
432}
433$sql .= " WHERE s.entity IN (".getEntity('societe').") AND sp.fk_soc = s.rowid";
434$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
435if (!$user->hasRight('societe', 'client', 'voir')) {
436 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
437}
438if (!$user->hasRight('fournisseur', 'lire')) {
439 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
440}
441// Add where from hooks
442$parameters = array('socid' => $socid);
443$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
444if (empty($reshook)) {
445 if ($socid > 0) {
446 $sql .= " AND s.rowid = ".((int) $socid);
447 }
448}
449$sql .= $hookmanager->resPrint;
450$sql .= $db->order("s.tms", "DESC");
451$sql .= $db->plimit($max, 0);
452
453//print $sql;
454$lastmodifiedcontact = '';
455$result = $db->query($sql);
456if ($result) {
457 $num = $db->num_rows($result);
458
459 $i = 0;
460
461 if ($num > 0) {
462 $transRecordedType = $langs->trans("LastModifiedContacts", $max);
463
464 $lastmodifiedcontact = "\n<!-- last contacts modified -->\n";
465 $lastmodifiedcontact .= '<div class="div-table-responsive-no-min">';
466 $lastmodifiedcontact .= '<table class="noborder centpercent">';
467
468 $lastmodifiedcontact .= '<tr class="liste_titre"><th colspan="2">';
469 //$lastmodifiedcontact .= img_picto('', 'contact', 'class="pictofixedwidth"');
470 $lastmodifiedcontact .= '<span class="valignmiddle">'.$transRecordedType.'</div>';
471 $lastmodifiedcontact .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/contact/list.php?sortfield=p.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
472 //$lastmodifiedcontact .= img_picto($langs->trans("FullList"), 'contact');
473 $lastmodifiedcontact .= '<span class="badge marginleftonlyshort">...</span>';
474 $lastmodifiedcontact .= '</th>';
475 $lastmodifiedcontact .= '<th>&nbsp;</th>';
476 $lastmodifiedcontact .= '<th class="right">';
477 //$lastmodifiedcontact .= '<a href="'.DOL_URL_ROOT.'/contact/list.php?sortfield=s.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'contact');
478 $lastmodifiedcontact .= '</th>';
479 $lastmodifiedcontact .= '</tr>'."\n";
480
481 while ($i < $num) {
482 $objp = $db->fetch_object($result);
483
484 $thirdparty_static->id = $objp->rowid;
485 $thirdparty_static->name = $objp->name;
486 $thirdparty_static->client = $objp->client;
487 $thirdparty_static->fournisseur = $objp->fournisseur;
488 $thirdparty_static->logo = $objp->logo;
489 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
490 $thirdparty_static->status = $objp->status;
491 $thirdparty_static->code_client = $objp->code_client;
492 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
493 $thirdparty_static->canvas = $objp->canvas;
494 $thirdparty_static->email = $objp->email;
495 $thirdparty_static->entity = $objp->entity;
496 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
497 $thirdparty_static->code_compta_client = $objp->code_compta;
498
499 $contact_static->id = $objp->cid;
500 $contact_static->firstname = $objp->firstname;
501 $contact_static->lastname = $objp->lastname;
502 $contact_static->email = $objp->cemail;
503 $contact_static->socid = $objp->rowid;
504 $contact_static->canvas = $objp->ccanvas;
505 $contact_static->phone_pro = $objp->cphone;
506 $contact_static->address = $objp->caddress;
507
508 $lastmodifiedcontact .= '<tr class="oddeven">';
509 // Contact
510 $lastmodifiedcontact .= '<td>';
511 $lastmodifiedcontact .= $contact_static->getNomUrl(1);
512 $lastmodifiedcontact .= '</td>';
513 // Third party
514 $lastmodifiedcontact .= '<td class="nowrap tdoverflowmax200">';
515 $lastmodifiedcontact .= $thirdparty_static->getNomUrl(1);
516 $lastmodifiedcontact .= "</td>\n";
517 // Last modified date
518 $lastmodifiedcontact .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
519 $lastmodifiedcontact .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
520 $lastmodifiedcontact .= "</td>";
521 $lastmodifiedcontact .= '<td class="right nowrap">';
522 $lastmodifiedcontact .= $thirdparty_static->getLibStatut(3);
523 $lastmodifiedcontact .= "</td>";
524 $lastmodifiedcontact .= "</tr>\n";
525 $i++;
526 }
527
528 $db->free($result);
529
530 $lastmodifiedcontact .= "</table>\n";
531 $lastmodifiedcontact .= '</div>';
532 $lastmodifiedcontact .= "<!-- End last contacts modified -->\n";
533 }
534} else {
535 dol_print_error($db);
536}
537
538
539// boxes
540print '<div class="clearboth"></div>';
541print '<div class="fichecenter fichecenterbis">';
542
543$boxlist = '<div class="twocolumns">';
544
545$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
546$boxlist .= $thirdpartygraph;
547$boxlist .= '<br>';
548$boxlist .= $thirdpartycateggraph;
549$boxlist .= '<br>';
550$boxlist .= $resultboxes['boxlista'];
551$boxlist .= '</div>'."\n";
552
553$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
554$boxlist .= $lastmodified;
555$boxlist .= '<br>';
556$boxlist .= $lastmodifiedcontact;
557$boxlist .= '<br>';
558$boxlist .= $resultboxes['boxlistb'];
559$boxlist .= '</div>'."\n";
560
561$boxlist .= '</div>';
562
563print $boxlist;
564
565print '</div>';
566
567$parameters = array('user' => $user);
568$reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
569
570// End of page
571llxFooter();
572$db->close();
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:71
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 hooks.
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
Class to manage third parties objects (customers, suppliers, prospects...)
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.