dolibarr 20.0.0
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 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
33require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
35
36
37// Load translation files required by the page
38$langs->load("companies");
39
40
41// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
42$hookmanager = new HookManager($db);
43$hookmanager->initHooks(array('thirdpartiesindex'));
44
45
46$socid = GETPOSTINT('socid');
47if ($user->socid) {
48 $socid = $user->socid;
49}
50
51// Security check
52$result = restrictedArea($user, 'societe|contact', 0, '', '', '', '');
53
54$thirdparty_static = new Societe($db);
55$contact_static = new Contact($db);
56
57if (!isset($form) || !is_object($form)) {
58 $form = new Form($db);
59}
60
61// Load $resultboxes
62$resultboxes = FormOther::getBoxesArea($user, "3");
63
64if (GETPOST('addbox')) {
65 // Add box (when submit is done from a form when ajax disabled)
66 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
67 $zone = GETPOSTINT('areacode');
68 $userid = GETPOSTINT('userid');
69 $boxorder = GETPOST('boxorder', 'aZ09');
70 $boxorder .= GETPOST('boxcombo', 'aZ09');
71 $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
72 if ($result > 0) {
73 setEventMessages($langs->trans("BoxAdded"), null);
74 }
75}
76
77$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
78
79
80/*
81 * View
82 */
83
84$transAreaType = $langs->trans("ThirdPartiesArea");
85$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Terceros';
86
87llxHeader("", $langs->trans("ThirdParties"), $helpurl);
88
89print load_fiche_titre($transAreaType, $resultboxes['selectboxlist'], 'companies');
90
91
92// Statistics area
93
94$third = array(
95 'customer' => 0,
96 'prospect' => 0,
97 'supplier' => 0,
98 'other' =>0
99);
100$total = 0;
101
102$sql = "SELECT s.rowid, s.client, s.fournisseur";
103$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
104if (!$user->hasRight('societe', 'client', 'voir')) {
105 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
106}
107$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
108if (!$user->hasRight('societe', 'client', 'voir')) {
109 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
110}
111if (!$user->hasRight('fournisseur', 'lire')) {
112 $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
113}
114// Add where from hooks
115$parameters = array('socid' => $socid);
116$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
117if (empty($reshook)) {
118 if ($socid > 0) {
119 $sql .= " AND s.rowid = ".((int) $socid);
120 }
121}
122$sql .= $hookmanager->resPrint;
123//print $sql;
124$result = $db->query($sql);
125if ($result) {
126 while ($objp = $db->fetch_object($result)) {
127 $found = 0;
128 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS') && ($objp->client == 2 || $objp->client == 3)) {
129 $found = 1;
130 $third['prospect']++;
131 }
132 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS') && ($objp->client == 1 || $objp->client == 3)) {
133 $found = 1;
134 $third['customer']++;
135 }
136 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) {
137 $found = 1;
138 $third['supplier']++;
139 }
140 if (isModEnabled('societe') && $objp->client == 0 && $objp->fournisseur == 0) {
141 $found = 1;
142 $third['other']++;
143 }
144 if ($found) {
145 $total++;
146 }
147 }
148} else {
149 dol_print_error($db);
150}
151
152$thirdpartygraph = '<div class="div-table-responsive-no-min">';
153$thirdpartygraph .= '<table class="noborder nohover centpercent">'."\n";
154$thirdpartygraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
155if (!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)) {
156 $thirdpartygraph .= '<tr><td class="center" colspan="2">';
157 $dataseries = array();
158 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
159 $dataseries[] = array($langs->transnoentitiesnoconv("Prospects"), round($third['prospect']));
160 }
161 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
162 $dataseries[] = array($langs->transnoentitiesnoconv("Customers"), round($third['customer']));
163 }
164 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')) {
165 $dataseries[] = array($langs->transnoentitiesnoconv("Suppliers"), round($third['supplier']));
166 }
167 if (isModEnabled('societe')) {
168 $dataseries[] = array($langs->transnoentitiesnoconv("Others"), round($third['other']));
169 }
170 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
171 $dolgraph = new DolGraph();
172 $dolgraph->SetData($dataseries);
173 $dolgraph->setShowLegend(2);
174 $dolgraph->setShowPercent(1);
175 $dolgraph->SetType(array('pie'));
176 $dolgraph->setHeight('200');
177 $dolgraph->draw('idgraphthirdparties');
178 $thirdpartygraph .= $dolgraph->show();
179 $thirdpartygraph .= '</td></tr>'."\n";
180} else {
181 $statstring = '';
182 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
183 $statstring .= "<tr>";
184 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
185 $statstring .= "</tr>";
186 }
187 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
188 $statstring .= "<tr>";
189 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
190 $statstring .= "</tr>";
191 }
192 $statstring2 = '';
193 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')) {
194 $statstring2 .= "<tr>";
195 $statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
196 $statstring2 .= "</tr>";
197 }
198 $thirdpartygraph .= $statstring;
199 $thirdpartygraph .= $statstring2;
200}
201$thirdpartygraph .= '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td class="right">';
202$thirdpartygraph .= $total;
203$thirdpartygraph .= '</td></tr>';
204$thirdpartygraph .= '</table>';
205$thirdpartygraph .= '</div>';
206
207$thirdpartycateggraph = '';
208if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES')) {
209 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
210 $elementtype = 'societe';
211
212 $thirdpartycateggraph = '<div class="div-table-responsive-no-min">';
213 $thirdpartycateggraph .= '<table class="noborder nohover centpercent">';
214 $thirdpartycateggraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
215 $thirdpartycateggraph .= '<tr><td class="center" colspan="2">';
216 $sql = "SELECT c.label, count(*) as nb";
217 $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
218 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
219 $sql .= " WHERE c.type = 2";
220 if (!is_numeric(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))) {
221 $sql .= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'";
222 }
223 $sql .= " AND c.entity IN (".getEntity('category').")";
224 $sql .= " GROUP BY c.label";
225 $total = 0;
226 $result = $db->query($sql);
227 if ($result) {
228 $num = $db->num_rows($result);
229 $i = 0;
230 if (!empty($conf->use_javascript_ajax)) {
231 $dataseries = array();
232 $rest = 0;
233 $nbmax = 10;
234
235 while ($i < $num) {
236 $obj = $db->fetch_object($result);
237 if ($i < $nbmax) {
238 $dataseries[] = array($obj->label, round($obj->nb));
239 } else {
240 $rest += $obj->nb;
241 }
242 $total += $obj->nb;
243 $i++;
244 }
245 if ($i > $nbmax) {
246 $dataseries[] = array($langs->trans("Other"), round($rest));
247 }
248 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
249 $dolgraph = new DolGraph();
250 $dolgraph->SetData($dataseries);
251 $dolgraph->setShowLegend(2);
252 $dolgraph->setShowPercent(1);
253 $dolgraph->SetType(array('pie'));
254 $dolgraph->setHeight('200');
255 $dolgraph->draw('idgraphcateg');
256 $thirdpartycateggraph .= $dolgraph->show();
257 } else {
258 while ($i < $num) {
259 $obj = $db->fetch_object($result);
260
261 $thirdpartycateggraph .= '<tr class="oddeven"><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
262 $total += $obj->nb;
263 $i++;
264 }
265 }
266 }
267 $thirdpartycateggraph .= '</td></tr>';
268 $thirdpartycateggraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
269 $thirdpartycateggraph .= $total;
270 $thirdpartycateggraph .= '</td></tr>';
271 $thirdpartycateggraph .= '</table>';
272 $thirdpartycateggraph .= '</div>';
273} else {
274 $thirdpartycateggraph = '';
275}
276
277
278/*
279 * Latest modified third parties
280 */
281$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
282$sql .= ", s.code_client";
283$sql .= ", s.code_fournisseur";
284if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
285 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
286 $sql .= ", spe.accountancy_code_customer as code_compta";
287} else {
288 $sql .= ", s.code_compta_fournisseur";
289 $sql .= ", s.code_compta";
290}
291$sql .= ", s.logo";
292$sql .= ", s.entity";
293$sql .= ", s.canvas, s.tms as date_modification, s.status as status";
294$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
295if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
296 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
297}
298// TODO Replace this
299if (!$user->hasRight('societe', 'client', 'voir')) {
300 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
301}
302$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
303if (!$user->hasRight('societe', 'client', 'voir')) {
304 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
305}
306if (!$user->hasRight('fournisseur', 'lire')) {
307 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
308}
309// Add where from hooks
310$parameters = array('socid' => $socid);
311$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
312if (empty($reshook)) {
313 if ($socid > 0) {
314 $sql .= " AND s.rowid = ".((int) $socid);
315 }
316}
317$sql .= $hookmanager->resPrint;
318$sql .= $db->order("s.tms", "DESC");
319$sql .= $db->plimit($max, 0);
320
321//print $sql;
322$lastmodified="";
323$result = $db->query($sql);
324if ($result) {
325 $num = $db->num_rows($result);
326
327 $i = 0;
328
329 if ($num > 0) {
330 $transRecordedType = $langs->trans("LastModifiedThirdParties", $max);
331
332 $lastmodified = "\n<!-- last thirdparties modified -->\n";
333 $lastmodified .= '<div class="div-table-responsive-no-min">';
334 $lastmodified .= '<table class="noborder centpercent">';
335
336 $lastmodified .= '<tr class="liste_titre"><th colspan="2">';
337 //$lastmodified .= img_picto('', 'company', 'class="pictofixedwidth"');
338 $lastmodified .= '<span class="valignmiddle">'.$transRecordedType.'</span>';
339 $lastmodified .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
340 $lastmodified .= '<span class="badge marginleftonlyshort">...</span>';
341 $lastmodified .= '</a>';
342 $lastmodified .= '</th>';
343 $lastmodified .= '<th>&nbsp;</th>';
344 $lastmodified .= '<th class="right">';
345 $lastmodified .= '</th>';
346 $lastmodified .= '</tr>'."\n";
347
348 while ($i < $num) {
349 $objp = $db->fetch_object($result);
350
351 $thirdparty_static->id = $objp->rowid;
352 $thirdparty_static->name = $objp->name;
353 $thirdparty_static->client = $objp->client;
354 $thirdparty_static->fournisseur = $objp->fournisseur;
355 $thirdparty_static->logo = $objp->logo;
356 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
357 $thirdparty_static->status = $objp->status;
358 $thirdparty_static->code_client = $objp->code_client;
359 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
360 $thirdparty_static->canvas = $objp->canvas;
361 $thirdparty_static->email = $objp->email;
362 $thirdparty_static->entity = $objp->entity;
363 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
364 $thirdparty_static->code_compta_client = $objp->code_compta;
365
366 $lastmodified .= '<tr class="oddeven">';
367 // Name
368 $lastmodified .= '<td class="nowrap tdoverflowmax200">';
369 $lastmodified .= $thirdparty_static->getNomUrl(1);
370 $lastmodified .= "</td>\n";
371 // Type
372 $lastmodified .= '<td class="center">';
373 $lastmodified .= $thirdparty_static->getTypeUrl();
374 $lastmodified .= '</td>';
375 // Last modified date
376 $lastmodified .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
377 $lastmodified .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
378 $lastmodified .= "</td>";
379 $lastmodified .= '<td class="right nowrap">';
380 $lastmodified .= $thirdparty_static->getLibStatut(3);
381 $lastmodified .= "</td>";
382 $lastmodified .= "</tr>\n";
383 $i++;
384 }
385
386 $db->free($result);
387
388 $lastmodified .= "</table>\n";
389 $lastmodified .= '</div>';
390 $lastmodified .= "<!-- End last thirdparties modified -->\n";
391 }
392} else {
393 dol_print_error($db);
394}
395
396
397
398/*
399 * Latest modified contacts
400 */
401$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
402$sql .= ", s.code_client";
403$sql .= ", s.code_fournisseur";
404if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
405 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
406 $sql .= ", spe.accountancy_code_customer as code_compta";
407} else {
408 $sql .= ", s.code_compta_fournisseur";
409 $sql .= ", s.code_compta";
410}
411$sql .= ", s.logo";
412$sql .= ", s.entity";
413$sql .= ", s.canvas";
414$sql .= ", s.tms as date_modification, s.status as status";
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, ".MAIN_DB_PREFIX."socpeople as sp";
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').') AND sp.fk_soc = s.rowid';
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("s.tms", "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->firstname = $objp->firstname;
492 $contact_static->lastname = $objp->lastname;
493 $contact_static->email = $objp->cemail;
494 $contact_static->socid = $objp->rowid;
495 $contact_static->canvas = $objp->ccanvas;
496 $contact_static->phone_pro = $objp->cphone;
497 $contact_static->address = $objp->caddress;
498
499 $lastmodifiedcontact .= '<tr class="oddeven">';
500 // Contact
501 $lastmodifiedcontact .= '<td>';
502 $lastmodifiedcontact .= $contact_static->getNomUrl(1);
503 $lastmodifiedcontact .= '</td>';
504 // Third party
505 $lastmodifiedcontact .= '<td class="nowrap tdoverflowmax200">';
506 $lastmodifiedcontact .= $thirdparty_static->getNomUrl(1);
507 $lastmodifiedcontact .= "</td>\n";
508 // Last modified date
509 $lastmodifiedcontact .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
510 $lastmodifiedcontact .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
511 $lastmodifiedcontact .= "</td>";
512 $lastmodifiedcontact .= '<td class="right nowrap">';
513 $lastmodifiedcontact .= $thirdparty_static->getLibStatut(3);
514 $lastmodifiedcontact .= "</td>";
515 $lastmodifiedcontact .= "</tr>\n";
516 $i++;
517 }
518
519 $db->free($result);
520
521 $lastmodifiedcontact .= "</table>\n";
522 $lastmodifiedcontact .= '</div>';
523 $lastmodifiedcontact .= "<!-- End last contacts modified -->\n";
524 }
525} else {
526 dol_print_error($db);
527}
528
529
530// boxes
531print '<div class="clearboth"></div>';
532print '<div class="fichecenter fichecenterbis">';
533
534$boxlist = '<div class="twocolumns">';
535
536$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
537$boxlist .= $thirdpartygraph;
538$boxlist .= '<br>';
539$boxlist .= $thirdpartycateggraph;
540$boxlist .= '<br>';
541$boxlist .= $resultboxes['boxlista'];
542$boxlist .= '</div>'."\n";
543
544$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
545$boxlist .= $lastmodified;
546$boxlist .= '<br>';
547$boxlist .= $lastmodifiedcontact;
548$boxlist .= '<br>';
549$boxlist .= $resultboxes['boxlistb'];
550$boxlist .= '</div>'."\n";
551
552$boxlist .= '</div>';
553
554print $boxlist;
555
556print '</div>';
557
558$parameters = array('user' => $user);
559$reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
560
561// End of page
562llxFooter();
563$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
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 boxes of a particular area including personalized choices of user.
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...)
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 dolibarr global constant string value.
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.