Test Failed
Push — main ( f63f9e...9d38ca )
by Rafael
08:12
created
htdocs/index_dol.php 2 patches
Indentation   +669 added lines, -669 removed lines patch added patch discarded remove patch
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 
43 43
 // Check if company name is defined (first install)
44 44
 if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
45
-	header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
46
-	exit;
45
+    header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
46
+    exit;
47 47
 }
48 48
 if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) {	// If only user module enabled
49
-	header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
50
-	exit;
49
+    header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
50
+    exit;
51 51
 }
52 52
 if (GETPOST('addbox')) {	// Add box (when submit is done from a form when ajax disabled)
53
-	require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
54
-	$zone = GETPOST('areacode', 'int');
55
-	$userid = GETPOST('userid', 'int');
56
-	$boxorder = GETPOST('boxorder', 'aZ09');
57
-	$boxorder .= GETPOST('boxcombo', 'aZ09');
58
-
59
-	$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
60
-	if ($result > 0) {
61
-		setEventMessages($langs->trans("BoxAdded"), null);
62
-	}
53
+    require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
54
+    $zone = GETPOST('areacode', 'int');
55
+    $userid = GETPOST('userid', 'int');
56
+    $boxorder = GETPOST('boxorder', 'aZ09');
57
+    $boxorder .= GETPOST('boxcombo', 'aZ09');
58
+
59
+    $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
60
+    if ($result > 0) {
61
+        setEventMessages($langs->trans("BoxAdded"), null);
62
+    }
63 63
 }
64 64
 
65 65
 
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
  */
69 69
 
70 70
 if (!isset($form) || !is_object($form)) {
71
-	$form = new Form($db);
71
+    $form = new Form($db);
72 72
 }
73 73
 
74 74
 // Title
75 75
 $title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
76 76
 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
77
-	$title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
77
+    $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
78 78
 }
79 79
 
80 80
 llxHeader('', $title);
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 print load_fiche_titre('&nbsp;', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome');
87 87
 
88 88
 if (!empty($conf->global->MAIN_MOTD)) {
89
-	$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
90
-	if (!empty($conf->global->MAIN_MOTD)) {
91
-		$substitutionarray = getCommonSubstitutionArray($langs);
92
-		complete_substitutions_array($substitutionarray, $langs);
93
-		$texttoshow = make_substitutions($conf->global->MAIN_MOTD, $substitutionarray, $langs);
94
-
95
-		print "\n<!-- Start of welcome text -->\n";
96
-		print '<table width="100%" class="notopnoleftnoright"><tr><td>';
97
-		print dol_htmlentitiesbr($texttoshow);
98
-		print '</td></tr></table><br>';
99
-		print "\n<!-- End of welcome text -->\n";
100
-	}
89
+    $conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
90
+    if (!empty($conf->global->MAIN_MOTD)) {
91
+        $substitutionarray = getCommonSubstitutionArray($langs);
92
+        complete_substitutions_array($substitutionarray, $langs);
93
+        $texttoshow = make_substitutions($conf->global->MAIN_MOTD, $substitutionarray, $langs);
94
+
95
+        print "\n<!-- Start of welcome text -->\n";
96
+        print '<table width="100%" class="notopnoleftnoright"><tr><td>';
97
+        print dol_htmlentitiesbr($texttoshow);
98
+        print '</td></tr></table><br>';
99
+        print "\n<!-- End of welcome text -->\n";
100
+    }
101 101
 }
102 102
 
103 103
 /*
@@ -106,29 +106,29 @@  discard block
 block discarded – undo
106 106
 
107 107
 // Security warning repertoire install existe (si utilisateur admin)
108 108
 if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) {
109
-	$message = '';
110
-
111
-	// Check if install lock file is present
112
-	$lockfile = DOL_DATA_ROOT.'/install.lock';
113
-	if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
114
-		$langs->load("errors");
115
-		//if (! empty($message)) $message.='<br>';
116
-		$message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
117
-	}
118
-
119
-	// Conf files must be in read only mode
120
-	if (is_writable($conffile)) {
121
-		$langs->load("errors");
122
-		//$langs->load("other");
123
-		//if (! empty($message)) $message.='<br>';
124
-		$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
125
-	}
126
-
127
-	if ($message) {
128
-		print $message;
129
-		//$message.='<br>';
130
-		//print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install"));
131
-	}
109
+    $message = '';
110
+
111
+    // Check if install lock file is present
112
+    $lockfile = DOL_DATA_ROOT.'/install.lock';
113
+    if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
114
+        $langs->load("errors");
115
+        //if (! empty($message)) $message.='<br>';
116
+        $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
117
+    }
118
+
119
+    // Conf files must be in read only mode
120
+    if (is_writable($conffile)) {
121
+        $langs->load("errors");
122
+        //$langs->load("other");
123
+        //if (! empty($message)) $message.='<br>';
124
+        $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
125
+    }
126
+
127
+    if ($message) {
128
+        print $message;
129
+        //$message.='<br>';
130
+        //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install"));
131
+    }
132 132
 }
133 133
 
134 134
 /*
@@ -145,574 +145,574 @@  discard block
 block discarded – undo
145 145
 // Dolibarr Working Board with weather
146 146
 
147 147
 if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
148
-	$showweather = (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0;
149
-
150
-	//Array that contains all WorkboardResponse classes to process them
151
-	$dashboardlines = array();
152
-
153
-	// Do not include sections without management permission
154
-	require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
155
-
156
-	// Number of actions to do (late)
157
-	if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
158
-		include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
159
-		$board = new ActionComm($db);
160
-		$dashboardlines[$board->element] = $board->load_board($user);
161
-	}
162
-
163
-	// Number of project opened
164
-	if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
165
-		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
166
-		$board = new Project($db);
167
-		$dashboardlines[$board->element] = $board->load_board($user);
168
-	}
169
-
170
-	// Number of tasks to do (late)
171
-	if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
172
-		include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
173
-		$board = new Task($db);
174
-		$dashboardlines[$board->element] = $board->load_board($user);
175
-	}
176
-
177
-	// Number of commercial proposals open (expired)
178
-	if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
179
-		include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
180
-		$board = new Propal($db);
181
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
182
-		// Number of commercial proposals CLOSED signed (billed)
183
-		$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
184
-	}
185
-
186
-	// Number of commercial proposals open (expired)
187
-	if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
188
-		include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
189
-		$board = new SupplierProposal($db);
190
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
191
-		// Number of commercial proposals CLOSED signed (billed)
192
-		$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
193
-	}
194
-
195
-	// Number of customer orders a deal
196
-	if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
197
-		include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
198
-		$board = new Commande($db);
199
-		$dashboardlines[$board->element] = $board->load_board($user);
200
-	}
201
-
202
-	// Number of suppliers orders a deal
203
-	if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
204
-		include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
205
-		$board = new CommandeFournisseur($db);
206
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
207
-		$dashboardlines[$board->element.'_awaiting'] = $board->load_board($user, 'awaiting');
208
-	}
209
-
210
-	// Number of contract / services enabled (delayed)
211
-	if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
212
-		include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
213
-		$board = new Contrat($db);
214
-		$dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive");
215
-		// Number of active services (expired)
216
-		$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
217
-	}
218
-
219
-	// Number of tickets open
220
-	if (!empty($conf->ticket->enabled) && $user->rights->ticket->read) {
221
-		include_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
222
-		$board = new Ticket($db);
223
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
224
-		// Number of active services (expired)
225
-		//$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
226
-	}
227
-
228
-	// Number of invoices customers (paid)
229
-	if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
230
-		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
231
-		$board = new Facture($db);
232
-		$dashboardlines[$board->element] = $board->load_board($user);
233
-	}
234
-
235
-	// Number of supplier invoices (paid)
236
-	if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
237
-		include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
238
-		$board = new FactureFournisseur($db);
239
-		$dashboardlines[$board->element] = $board->load_board($user);
240
-	}
241
-
242
-	// Number of transactions to conciliate
243
-	if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) {
244
-		include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
245
-		$board = new Account($db);
246
-		$nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate
247
-		if ($nb > 0) {
248
-			$dashboardlines[$board->element] = $board->load_board($user);
249
-		}
250
-	}
251
-
252
-	// Number of cheque to send
253
-	if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
254
-		include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
255
-		$board = new RemiseCheque($db);
256
-		$dashboardlines[$board->element] = $board->load_board($user);
257
-	}
258
-
259
-	// Number of foundation members
260
-	if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
261
-		include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
262
-		$board = new Adherent($db);
263
-		$dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift');
264
-		$dashboardlines[$board->element.'_expired'] = $board->load_board($user, 'expired');
265
-	}
266
-
267
-	// Number of expense reports to approve
268
-	if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
269
-		include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
270
-		$board = new ExpenseReport($db);
271
-		$dashboardlines[$board->element.'_toapprove'] = $board->load_board($user, 'toapprove');
272
-	}
273
-
274
-	// Number of expense reports to pay
275
-	if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
276
-		include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
277
-		$board = new ExpenseReport($db);
278
-		$dashboardlines[$board->element.'_topay'] = $board->load_board($user, 'topay');
279
-	}
280
-
281
-	// Number of holidays to approve
282
-	if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
283
-		include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
284
-		$board = new Holiday($db);
285
-		$dashboardlines[$board->element] = $board->load_board($user);
286
-	}
287
-
288
-	$object = new stdClass();
289
-	$parameters = array();
290
-	$action = '';
291
-	$reshook = $hookmanager->executeHooks(
292
-		'addOpenElementsDashboardLine',
293
-		$parameters,
294
-		$object,
295
-		$action
296
-	); // Note that $action and $object may have been modified by some hooks
297
-	if ($reshook == 0) {
298
-		$dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
299
-	}
300
-
301
-	/* Open object dashboard */
302
-	$dashboardgroup = array(
303
-		'action' =>
304
-			array(
305
-				'groupName' => 'Agenda',
306
-				'stats' => array('action'),
307
-			),
308
-		'project' =>
309
-			array(
310
-				'groupName' => 'Projects',
311
-				'globalStatsKey' => 'projects',
312
-				'stats' => array('project', 'project_task'),
313
-			),
314
-		'propal' =>
315
-			array(
316
-				'groupName' => 'Proposals',
317
-				'globalStatsKey' => 'proposals',
318
-				'stats' =>
319
-					array('propal_opened', 'propal_signed'),
320
-			),
321
-		'commande' =>
322
-			array(
323
-				'groupName' => 'Orders',
324
-				'globalStatsKey' => 'orders',
325
-				'stats' =>
326
-					array('commande'),
327
-			),
328
-		'facture' =>
329
-			array(
330
-				'groupName' => 'Invoices',
331
-				'globalStatsKey' => 'invoices',
332
-				'stats' =>
333
-					array('facture'),
334
-			),
335
-		'supplier_proposal' =>
336
-			array(
337
-				'groupName' => 'SupplierProposals',
338
-				'globalStatsKey' => 'askprice',
339
-				'stats' =>
340
-					array('supplier_proposal_opened', 'supplier_proposal_signed'),
341
-			),
342
-		'order_supplier' =>
343
-			array(
344
-				'groupName' => 'SuppliersOrders',
345
-				'globalStatsKey' => 'supplier_orders',
346
-				'stats' =>
347
-					array('order_supplier_opened', 'order_supplier_awaiting'),
348
-			),
349
-		'invoice_supplier' =>
350
-			array(
351
-				'groupName' => 'BillsSuppliers',
352
-				'globalStatsKey' => 'supplier_invoices',
353
-				'stats' =>
354
-					array('invoice_supplier'),
355
-			),
356
-		'contrat' =>
357
-			array(
358
-				'groupName' => 'Contracts',
359
-				'globalStatsKey' => 'Contracts',
360
-				'stats' =>
361
-				array('contrat_inactive', 'contrat_active'),
362
-			),
363
-		'ticket' =>
364
-			array(
365
-				'groupName' => 'Tickets',
366
-				'globalStatsKey' => 'ticket',
367
-				'stats' =>
368
-					array('ticket_opened'),
369
-			),
370
-		'bank_account' =>
371
-			array(
372
-				'groupName' => 'BankAccount',
373
-				'stats' =>
374
-					array('bank_account', 'chequereceipt'),
375
-			),
376
-		'member' =>
377
-			array(
378
-				'groupName' => 'Members',
379
-				'globalStatsKey' => 'members',
380
-				'stats' =>
381
-					array('member_shift', 'member_expired'),
382
-			),
383
-		'expensereport' =>
384
-			array(
385
-				'groupName' => 'ExpenseReport',
386
-				'globalStatsKey' => 'expensereports',
387
-				'stats' =>
388
-					array('expensereport_toapprove', 'expensereport_topay'),
389
-			),
390
-		'holiday' =>
391
-			array(
392
-				'groupName' => 'Holidays',
393
-				'globalStatsKey' => 'holidays',
394
-				'stats' =>
395
-					array('holiday'),
396
-			),
397
-	);
398
-
399
-	$object = new stdClass();
400
-	$parameters = array(
401
-		'dashboardgroup' => $dashboardgroup
402
-	);
403
-	$reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
404
-	if ($reshook == 0) {
405
-		$dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray);
406
-	}
407
-
408
-
409
-	// Calculate total nb of late
410
-	$totallate = $totaltodo = 0;
411
-
412
-	//Remove any invalid response
413
-	//load_board can return an integer if failed or WorkboardResponse if OK
414
-	$valid_dashboardlines = array();
415
-	foreach ($dashboardlines as $workboardid => $tmp) {
416
-		if ($tmp instanceof WorkboardResponse) {
417
-			$tmp->id = $workboardid; // Complete the object to add its id into its name
418
-			$valid_dashboardlines[$workboardid] = $tmp;
419
-		}
420
-	}
421
-
422
-	// We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop
423
-	foreach ($valid_dashboardlines as $board) {
424
-		if ($board->nbtodolate > 0) {
425
-			$totaltodo += $board->nbtodo;
426
-			$totallate += $board->nbtodolate;
427
-		}
428
-	}
429
-
430
-	$openedDashBoardSize = 'info-box-sm'; // use sm by default
431
-	foreach ($dashboardgroup as $dashbordelement) {
432
-		if (is_array($dashbordelement['stats']) && count($dashbordelement['stats']) > 2) {
433
-			$openedDashBoardSize = ''; // use default info box size : big
434
-			break;
435
-		}
436
-	}
437
-
438
-	$totalLateNumber = $totallate;
439
-	$totallatePercentage = ((!empty($totaltodo)) ? round($totallate / $totaltodo * 100, 2) : 0);
440
-	if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
441
-		$totallate = $totallatePercentage;
442
-	}
443
-
444
-	$boxwork = '';
445
-	$boxwork .= '<div class="box">';
446
-	$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">'."\n";
447
-	$boxwork .= '<tr class="liste_titre">';
448
-	$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
449
-	if ($showweather) {
450
-		if ($totallate > 0) {
451
-			$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
452
-				"NActionsLate",
453
-				$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
454
-			).')';
455
-		} else {
456
-			$text = $langs->transnoentitiesnoconv("NoItemLate");
457
-		}
458
-		$text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
459
-		//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
460
-		$options = 'height="24px" style="float: right"';
461
-		$boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle');
462
-	}
463
-	$boxwork .= '</th>';
464
-	$boxwork .= '</tr>'."\n";
465
-
466
-	// Show dashboard
467
-	$nbworkboardempty = 0;
468
-	$isIntopOpenedDashBoard = $globalStatInTopOpenedDashBoard = array();
469
-	if (!empty($valid_dashboardlines)) {
470
-		$openedDashBoard = '';
471
-
472
-		$boxwork .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">';
473
-
474
-		foreach ($dashboardgroup as $groupKey => $groupElement) {
475
-			$boards = array();
476
-			if (empty($conf->global->MAIN_DISABLE_NEW_OPENED_DASH_BOARD)) {
477
-				foreach ($groupElement['stats'] as $infoKey) {
478
-					if (!empty($valid_dashboardlines[$infoKey])) {
479
-						$boards[] = $valid_dashboardlines[$infoKey];
480
-						$isIntopOpenedDashBoard[] = $infoKey;
481
-					}
482
-				}
483
-			}
484
-
485
-			if (!empty($boards)) {
486
-				$groupName = $langs->trans($groupElement['groupName']);
487
-				$groupKeyLowerCase = strtolower($groupKey);
488
-				$nbTotalForGroup = 0;
489
-
490
-				// global stats
491
-				$globalStatsKey = false;
492
-				if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])) { // can be filled by hook
493
-					$globalStatsKey = $groupElement['globalStatsKey'];
494
-					$groupElement['globalStats'] = array();
495
-
496
-					if (isset($keys) && is_array($keys) && in_array($globalStatsKey, $keys)) {
497
-						// get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
498
-						$keyIndex = array_search($globalStatsKey, $keys);
499
-
500
-						$classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : '');
501
-						if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) {
502
-							$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
503
-							$nbTotal = floatval($groupElement['globalStats']['total']);
504
-							if ($nbTotal >= 10000) {
505
-								$nbTotal = round($nbTotal / 1000, 2).'k';
506
-							}
507
-							$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
508
-							$groupElement['globalStats']['total'] = $nbTotal;
509
-							$groupElement['globalStats']['link'] = $links[$keyIndex];
510
-						}
511
-					}
512
-				}
513
-
514
-				$openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">'."\n";
515
-				$openedDashBoard .= '	<div class="info-box '.$openedDashBoardSize.'">'."\n";
516
-				$openedDashBoard .= '		<span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n";
517
-				$openedDashBoard .= '		<i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
518
-
519
-				// Show the span for the total of record
520
-				if (!empty($groupElement['globalStats'])) {
521
-					$globalStatInTopOpenedDashBoard[] = $globalStatsKey;
522
-					$openedDashBoard .= '<span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>';
523
-				}
524
-
525
-				$openedDashBoard .= '</span>'."\n";
526
-				$openedDashBoard .= '<div class="info-box-content">'."\n";
527
-
528
-				$openedDashBoard .= '<div class="info-box-title" title="'.strip_tags($groupName).'">'.$groupName.'</div>'."\n";
529
-				$openedDashBoard .= '<div class="info-box-lines">'."\n";
530
-
531
-				foreach ($boards as $board) {
532
-					$openedDashBoard .= '<div class="info-box-line">';
533
-
534
-					if (!empty($board->labelShort)) {
535
-						$infoName = '<span title="'.$board->label.'">'.$board->labelShort.'</span>';
536
-					} else {
537
-						$infoName = $board->label;
538
-					}
539
-
540
-					$textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate);
541
-					$textLateTitle .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
542
-
543
-					if ($board->id == 'bank_account') {
544
-						$textLateTitle .= '<br><span class="opacitymedium">'.$langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")).'</span>';
545
-					}
546
-
547
-					$textLate = '';
548
-					if ($board->nbtodolate > 0) {
549
-						$textLate .= '<span title="'.dol_escape_htmltag($textLateTitle).'" class="classfortooltip badge badge-warning">';
550
-						$textLate .= '<i class="fa fa-exclamation-triangle"></i> '.$board->nbtodolate;
551
-						$textLate .= '</span>';
552
-					}
553
-
554
-					$nbtodClass = '';
555
-					if ($board->nbtodo > 0) {
556
-						$nbtodClass = 'badge badge-info';
557
-					}
558
-
559
-					$openedDashBoard .= '			<a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
560
-					if ($textLate) {
561
-						if ($board->url_late) {
562
-							$openedDashBoard .= '</a>';
563
-							$openedDashBoard .= ' <a href="'.$board->url_late.'" class="info-box-text info-box-text-a paddingleft">';
564
-						} else {
565
-							$openedDashBoard .= ' ';
566
-						}
567
-						$openedDashBoard .= $textLate;
568
-					}
569
-					$openedDashBoard .= '</a>'."\n";
570
-
571
-					if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
572
-						$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
573
-					}
574
-					$openedDashBoard .= '</div>'."\n";
575
-				}
576
-
577
-				// TODO Add hook here to add more "info-box-line"
578
-
579
-				$openedDashBoard .= '		</div><!-- /.info-box-lines --></div><!-- /.info-box-content -->'."\n";
580
-				$openedDashBoard .= '	</div><!-- /.info-box -->'."\n";
581
-				$openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
582
-				$openedDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
583
-				$openedDashBoard .= "\n";
584
-			}
585
-		}
586
-
587
-		if ($showweather && !empty($isIntopOpenedDashBoard)) {
588
-			$appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '');
589
-			$weather = getWeatherStatus($totallate);
590
-
591
-			$text = '';
592
-			if ($totallate > 0) {
593
-				$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
594
-					"NActionsLate",
595
-					$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
596
-				).')';
597
-			} else {
598
-				$text = $langs->transnoentitiesnoconv("NoItemLate");
599
-			}
600
-			$text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
601
-
602
-			$weatherDashBoard = '<div class="box-flex-item '.$appendClass.'"><div class="box-flex-item-with-margin">'."\n";
603
-			$weatherDashBoard .= '	<div class="info-box '.$openedDashBoardSize.' info-box-weather info-box-weather-level'.$weather->level.'">'."\n";
604
-			$weatherDashBoard .= '		<span class="info-box-icon">';
605
-			$weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50');
606
-			$weatherDashBoard .= '       </span>'."\n";
607
-			$weatherDashBoard .= '		<div class="info-box-content">'."\n";
608
-			$weatherDashBoard .= '			<div class="info-box-title">'.$langs->trans('GlobalOpenedElemView').'</div>'."\n";
609
-
610
-			if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
611
-				$weatherDashBoard .= '			<span class="info-box-number">'.$langs->transnoentitiesnoconv(
612
-					"NActionsLate",
613
-					price($totallatePercentage).'%'
614
-				).'</span>'."\n";
615
-				$weatherDashBoard .= '			<span class="progress-description">'.$langs->trans(
616
-					'NActionsLate',
617
-					$totalLateNumber
618
-				).'</span>'."\n";
619
-			} else {
620
-				$weatherDashBoard .= '			<span class="info-box-number">'.$langs->transnoentitiesnoconv(
621
-					"NActionsLate",
622
-					$totalLateNumber
623
-				).'</span>'."\n";
624
-				if ($totallatePercentage > 0) {
625
-					$weatherDashBoard .= '			<span class="progress-description">'.$langs->trans(
626
-						'NActionsLate',
627
-						price($totallatePercentage).'%'
628
-					).'</span>'."\n";
629
-				}
630
-			}
631
-
632
-			$weatherDashBoard .= '		</div><!-- /.info-box-content -->'."\n";
633
-			$weatherDashBoard .= '	</div><!-- /.info-box -->'."\n";
634
-			$weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
635
-			$weatherDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
636
-			$weatherDashBoard .= "\n";
637
-
638
-			$openedDashBoard = $weatherDashBoard.$openedDashBoard;
639
-		}
640
-
641
-		if (!empty($isIntopOpenedDashBoard)) {
642
-			for ($i = 1; $i <= 10; $i++) {
643
-				$openedDashBoard .= '<div class="box-flex-item filler"></div>';
644
-			}
645
-		}
646
-
647
-		$nbworkboardcount = 0;
648
-		foreach ($valid_dashboardlines as $infoKey => $board) {
649
-			if (in_array($infoKey, $isIntopOpenedDashBoard)) {
650
-				// skip if info is present on top
651
-				continue;
652
-			}
653
-
654
-			if (empty($board->nbtodo)) {
655
-				$nbworkboardempty++;
656
-			}
657
-			$nbworkboardcount++;
658
-
659
-
660
-			$textlate = $langs->trans("NActionsLate", $board->nbtodolate);
661
-			$textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
662
-
663
-
664
-			$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">';
665
-			$boxwork .= '<div class="boxstatscontent">';
666
-			$boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' <span>'.$board->label.'</span></span><br>';
667
-			$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>';
668
-			if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
669
-				$boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>';
670
-			}
671
-			$boxwork .= '</div>';
672
-			if ($board->nbtodolate > 0) {
673
-				$boxwork .= '<div class="dashboardlinelatecoin nowrap">';
674
-				$boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
675
-				//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
676
-				$boxwork .= img_picto(
677
-					$textlate,
678
-					"warning_white",
679
-					'class="inline-block hideonsmartphone valigntextbottom"'
680
-				).'';
681
-				$boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
682
-				$boxwork .= $board->nbtodolate;
683
-				$boxwork .= '</span>';
684
-				$boxwork .= '</a>';
685
-				$boxwork .= '</div>';
686
-			}
687
-			$boxwork .= '</div></div>';
688
-			$boxwork .= "\n";
689
-		}
690
-
691
-		$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
692
-		$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
693
-		$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
694
-		$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
695
-
696
-		$boxwork .= '</div>';
697
-		$boxwork .= '</td></tr>';
698
-	} else {
699
-		$boxwork .= '<tr class="nohover">';
700
-		$boxwork .= '<td class="nohover valignmiddle opacitymedium">';
701
-		$boxwork .= $langs->trans("NoOpenedElementToProcess");
702
-		$boxwork .= '</td>';
703
-		$boxwork .= '</tr>';
704
-	}
705
-
706
-	$boxwork .= '</td></tr>';
707
-
708
-	$boxwork .= '</table>'; // End table array of working board
709
-	$boxwork .= '</div>';
710
-
711
-	if (!empty($isIntopOpenedDashBoard)) {
712
-		print '<div class="fichecenter">';
713
-		print '<div class="opened-dash-board-wrap"><div class="box-flex-container">'.$openedDashBoard.'</div></div>';
714
-		print '</div>';
715
-	}
148
+    $showweather = (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0;
149
+
150
+    //Array that contains all WorkboardResponse classes to process them
151
+    $dashboardlines = array();
152
+
153
+    // Do not include sections without management permission
154
+    require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
155
+
156
+    // Number of actions to do (late)
157
+    if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
158
+        include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
159
+        $board = new ActionComm($db);
160
+        $dashboardlines[$board->element] = $board->load_board($user);
161
+    }
162
+
163
+    // Number of project opened
164
+    if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
165
+        include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
166
+        $board = new Project($db);
167
+        $dashboardlines[$board->element] = $board->load_board($user);
168
+    }
169
+
170
+    // Number of tasks to do (late)
171
+    if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
172
+        include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
173
+        $board = new Task($db);
174
+        $dashboardlines[$board->element] = $board->load_board($user);
175
+    }
176
+
177
+    // Number of commercial proposals open (expired)
178
+    if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
179
+        include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
180
+        $board = new Propal($db);
181
+        $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
182
+        // Number of commercial proposals CLOSED signed (billed)
183
+        $dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
184
+    }
185
+
186
+    // Number of commercial proposals open (expired)
187
+    if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
188
+        include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
189
+        $board = new SupplierProposal($db);
190
+        $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
191
+        // Number of commercial proposals CLOSED signed (billed)
192
+        $dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
193
+    }
194
+
195
+    // Number of customer orders a deal
196
+    if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
197
+        include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
198
+        $board = new Commande($db);
199
+        $dashboardlines[$board->element] = $board->load_board($user);
200
+    }
201
+
202
+    // Number of suppliers orders a deal
203
+    if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
204
+        include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
205
+        $board = new CommandeFournisseur($db);
206
+        $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
207
+        $dashboardlines[$board->element.'_awaiting'] = $board->load_board($user, 'awaiting');
208
+    }
209
+
210
+    // Number of contract / services enabled (delayed)
211
+    if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
212
+        include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
213
+        $board = new Contrat($db);
214
+        $dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive");
215
+        // Number of active services (expired)
216
+        $dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
217
+    }
218
+
219
+    // Number of tickets open
220
+    if (!empty($conf->ticket->enabled) && $user->rights->ticket->read) {
221
+        include_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
222
+        $board = new Ticket($db);
223
+        $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
224
+        // Number of active services (expired)
225
+        //$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
226
+    }
227
+
228
+    // Number of invoices customers (paid)
229
+    if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
230
+        include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
231
+        $board = new Facture($db);
232
+        $dashboardlines[$board->element] = $board->load_board($user);
233
+    }
234
+
235
+    // Number of supplier invoices (paid)
236
+    if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
237
+        include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
238
+        $board = new FactureFournisseur($db);
239
+        $dashboardlines[$board->element] = $board->load_board($user);
240
+    }
241
+
242
+    // Number of transactions to conciliate
243
+    if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) {
244
+        include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
245
+        $board = new Account($db);
246
+        $nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate
247
+        if ($nb > 0) {
248
+            $dashboardlines[$board->element] = $board->load_board($user);
249
+        }
250
+    }
251
+
252
+    // Number of cheque to send
253
+    if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
254
+        include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
255
+        $board = new RemiseCheque($db);
256
+        $dashboardlines[$board->element] = $board->load_board($user);
257
+    }
258
+
259
+    // Number of foundation members
260
+    if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
261
+        include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
262
+        $board = new Adherent($db);
263
+        $dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift');
264
+        $dashboardlines[$board->element.'_expired'] = $board->load_board($user, 'expired');
265
+    }
266
+
267
+    // Number of expense reports to approve
268
+    if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
269
+        include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
270
+        $board = new ExpenseReport($db);
271
+        $dashboardlines[$board->element.'_toapprove'] = $board->load_board($user, 'toapprove');
272
+    }
273
+
274
+    // Number of expense reports to pay
275
+    if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
276
+        include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
277
+        $board = new ExpenseReport($db);
278
+        $dashboardlines[$board->element.'_topay'] = $board->load_board($user, 'topay');
279
+    }
280
+
281
+    // Number of holidays to approve
282
+    if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
283
+        include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
284
+        $board = new Holiday($db);
285
+        $dashboardlines[$board->element] = $board->load_board($user);
286
+    }
287
+
288
+    $object = new stdClass();
289
+    $parameters = array();
290
+    $action = '';
291
+    $reshook = $hookmanager->executeHooks(
292
+        'addOpenElementsDashboardLine',
293
+        $parameters,
294
+        $object,
295
+        $action
296
+    ); // Note that $action and $object may have been modified by some hooks
297
+    if ($reshook == 0) {
298
+        $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
299
+    }
300
+
301
+    /* Open object dashboard */
302
+    $dashboardgroup = array(
303
+        'action' =>
304
+            array(
305
+                'groupName' => 'Agenda',
306
+                'stats' => array('action'),
307
+            ),
308
+        'project' =>
309
+            array(
310
+                'groupName' => 'Projects',
311
+                'globalStatsKey' => 'projects',
312
+                'stats' => array('project', 'project_task'),
313
+            ),
314
+        'propal' =>
315
+            array(
316
+                'groupName' => 'Proposals',
317
+                'globalStatsKey' => 'proposals',
318
+                'stats' =>
319
+                    array('propal_opened', 'propal_signed'),
320
+            ),
321
+        'commande' =>
322
+            array(
323
+                'groupName' => 'Orders',
324
+                'globalStatsKey' => 'orders',
325
+                'stats' =>
326
+                    array('commande'),
327
+            ),
328
+        'facture' =>
329
+            array(
330
+                'groupName' => 'Invoices',
331
+                'globalStatsKey' => 'invoices',
332
+                'stats' =>
333
+                    array('facture'),
334
+            ),
335
+        'supplier_proposal' =>
336
+            array(
337
+                'groupName' => 'SupplierProposals',
338
+                'globalStatsKey' => 'askprice',
339
+                'stats' =>
340
+                    array('supplier_proposal_opened', 'supplier_proposal_signed'),
341
+            ),
342
+        'order_supplier' =>
343
+            array(
344
+                'groupName' => 'SuppliersOrders',
345
+                'globalStatsKey' => 'supplier_orders',
346
+                'stats' =>
347
+                    array('order_supplier_opened', 'order_supplier_awaiting'),
348
+            ),
349
+        'invoice_supplier' =>
350
+            array(
351
+                'groupName' => 'BillsSuppliers',
352
+                'globalStatsKey' => 'supplier_invoices',
353
+                'stats' =>
354
+                    array('invoice_supplier'),
355
+            ),
356
+        'contrat' =>
357
+            array(
358
+                'groupName' => 'Contracts',
359
+                'globalStatsKey' => 'Contracts',
360
+                'stats' =>
361
+                array('contrat_inactive', 'contrat_active'),
362
+            ),
363
+        'ticket' =>
364
+            array(
365
+                'groupName' => 'Tickets',
366
+                'globalStatsKey' => 'ticket',
367
+                'stats' =>
368
+                    array('ticket_opened'),
369
+            ),
370
+        'bank_account' =>
371
+            array(
372
+                'groupName' => 'BankAccount',
373
+                'stats' =>
374
+                    array('bank_account', 'chequereceipt'),
375
+            ),
376
+        'member' =>
377
+            array(
378
+                'groupName' => 'Members',
379
+                'globalStatsKey' => 'members',
380
+                'stats' =>
381
+                    array('member_shift', 'member_expired'),
382
+            ),
383
+        'expensereport' =>
384
+            array(
385
+                'groupName' => 'ExpenseReport',
386
+                'globalStatsKey' => 'expensereports',
387
+                'stats' =>
388
+                    array('expensereport_toapprove', 'expensereport_topay'),
389
+            ),
390
+        'holiday' =>
391
+            array(
392
+                'groupName' => 'Holidays',
393
+                'globalStatsKey' => 'holidays',
394
+                'stats' =>
395
+                    array('holiday'),
396
+            ),
397
+    );
398
+
399
+    $object = new stdClass();
400
+    $parameters = array(
401
+        'dashboardgroup' => $dashboardgroup
402
+    );
403
+    $reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
404
+    if ($reshook == 0) {
405
+        $dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray);
406
+    }
407
+
408
+
409
+    // Calculate total nb of late
410
+    $totallate = $totaltodo = 0;
411
+
412
+    //Remove any invalid response
413
+    //load_board can return an integer if failed or WorkboardResponse if OK
414
+    $valid_dashboardlines = array();
415
+    foreach ($dashboardlines as $workboardid => $tmp) {
416
+        if ($tmp instanceof WorkboardResponse) {
417
+            $tmp->id = $workboardid; // Complete the object to add its id into its name
418
+            $valid_dashboardlines[$workboardid] = $tmp;
419
+        }
420
+    }
421
+
422
+    // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop
423
+    foreach ($valid_dashboardlines as $board) {
424
+        if ($board->nbtodolate > 0) {
425
+            $totaltodo += $board->nbtodo;
426
+            $totallate += $board->nbtodolate;
427
+        }
428
+    }
429
+
430
+    $openedDashBoardSize = 'info-box-sm'; // use sm by default
431
+    foreach ($dashboardgroup as $dashbordelement) {
432
+        if (is_array($dashbordelement['stats']) && count($dashbordelement['stats']) > 2) {
433
+            $openedDashBoardSize = ''; // use default info box size : big
434
+            break;
435
+        }
436
+    }
437
+
438
+    $totalLateNumber = $totallate;
439
+    $totallatePercentage = ((!empty($totaltodo)) ? round($totallate / $totaltodo * 100, 2) : 0);
440
+    if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
441
+        $totallate = $totallatePercentage;
442
+    }
443
+
444
+    $boxwork = '';
445
+    $boxwork .= '<div class="box">';
446
+    $boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">'."\n";
447
+    $boxwork .= '<tr class="liste_titre">';
448
+    $boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
449
+    if ($showweather) {
450
+        if ($totallate > 0) {
451
+            $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
452
+                "NActionsLate",
453
+                $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
454
+            ).')';
455
+        } else {
456
+            $text = $langs->transnoentitiesnoconv("NoItemLate");
457
+        }
458
+        $text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
459
+        //$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
460
+        $options = 'height="24px" style="float: right"';
461
+        $boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle');
462
+    }
463
+    $boxwork .= '</th>';
464
+    $boxwork .= '</tr>'."\n";
465
+
466
+    // Show dashboard
467
+    $nbworkboardempty = 0;
468
+    $isIntopOpenedDashBoard = $globalStatInTopOpenedDashBoard = array();
469
+    if (!empty($valid_dashboardlines)) {
470
+        $openedDashBoard = '';
471
+
472
+        $boxwork .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">';
473
+
474
+        foreach ($dashboardgroup as $groupKey => $groupElement) {
475
+            $boards = array();
476
+            if (empty($conf->global->MAIN_DISABLE_NEW_OPENED_DASH_BOARD)) {
477
+                foreach ($groupElement['stats'] as $infoKey) {
478
+                    if (!empty($valid_dashboardlines[$infoKey])) {
479
+                        $boards[] = $valid_dashboardlines[$infoKey];
480
+                        $isIntopOpenedDashBoard[] = $infoKey;
481
+                    }
482
+                }
483
+            }
484
+
485
+            if (!empty($boards)) {
486
+                $groupName = $langs->trans($groupElement['groupName']);
487
+                $groupKeyLowerCase = strtolower($groupKey);
488
+                $nbTotalForGroup = 0;
489
+
490
+                // global stats
491
+                $globalStatsKey = false;
492
+                if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])) { // can be filled by hook
493
+                    $globalStatsKey = $groupElement['globalStatsKey'];
494
+                    $groupElement['globalStats'] = array();
495
+
496
+                    if (isset($keys) && is_array($keys) && in_array($globalStatsKey, $keys)) {
497
+                        // get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
498
+                        $keyIndex = array_search($globalStatsKey, $keys);
499
+
500
+                        $classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : '');
501
+                        if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) {
502
+                            $groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
503
+                            $nbTotal = floatval($groupElement['globalStats']['total']);
504
+                            if ($nbTotal >= 10000) {
505
+                                $nbTotal = round($nbTotal / 1000, 2).'k';
506
+                            }
507
+                            $groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
508
+                            $groupElement['globalStats']['total'] = $nbTotal;
509
+                            $groupElement['globalStats']['link'] = $links[$keyIndex];
510
+                        }
511
+                    }
512
+                }
513
+
514
+                $openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">'."\n";
515
+                $openedDashBoard .= '	<div class="info-box '.$openedDashBoardSize.'">'."\n";
516
+                $openedDashBoard .= '		<span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n";
517
+                $openedDashBoard .= '		<i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
518
+
519
+                // Show the span for the total of record
520
+                if (!empty($groupElement['globalStats'])) {
521
+                    $globalStatInTopOpenedDashBoard[] = $globalStatsKey;
522
+                    $openedDashBoard .= '<span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>';
523
+                }
524
+
525
+                $openedDashBoard .= '</span>'."\n";
526
+                $openedDashBoard .= '<div class="info-box-content">'."\n";
527
+
528
+                $openedDashBoard .= '<div class="info-box-title" title="'.strip_tags($groupName).'">'.$groupName.'</div>'."\n";
529
+                $openedDashBoard .= '<div class="info-box-lines">'."\n";
530
+
531
+                foreach ($boards as $board) {
532
+                    $openedDashBoard .= '<div class="info-box-line">';
533
+
534
+                    if (!empty($board->labelShort)) {
535
+                        $infoName = '<span title="'.$board->label.'">'.$board->labelShort.'</span>';
536
+                    } else {
537
+                        $infoName = $board->label;
538
+                    }
539
+
540
+                    $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate);
541
+                    $textLateTitle .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
542
+
543
+                    if ($board->id == 'bank_account') {
544
+                        $textLateTitle .= '<br><span class="opacitymedium">'.$langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")).'</span>';
545
+                    }
546
+
547
+                    $textLate = '';
548
+                    if ($board->nbtodolate > 0) {
549
+                        $textLate .= '<span title="'.dol_escape_htmltag($textLateTitle).'" class="classfortooltip badge badge-warning">';
550
+                        $textLate .= '<i class="fa fa-exclamation-triangle"></i> '.$board->nbtodolate;
551
+                        $textLate .= '</span>';
552
+                    }
553
+
554
+                    $nbtodClass = '';
555
+                    if ($board->nbtodo > 0) {
556
+                        $nbtodClass = 'badge badge-info';
557
+                    }
558
+
559
+                    $openedDashBoard .= '			<a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
560
+                    if ($textLate) {
561
+                        if ($board->url_late) {
562
+                            $openedDashBoard .= '</a>';
563
+                            $openedDashBoard .= ' <a href="'.$board->url_late.'" class="info-box-text info-box-text-a paddingleft">';
564
+                        } else {
565
+                            $openedDashBoard .= ' ';
566
+                        }
567
+                        $openedDashBoard .= $textLate;
568
+                    }
569
+                    $openedDashBoard .= '</a>'."\n";
570
+
571
+                    if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
572
+                        $openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
573
+                    }
574
+                    $openedDashBoard .= '</div>'."\n";
575
+                }
576
+
577
+                // TODO Add hook here to add more "info-box-line"
578
+
579
+                $openedDashBoard .= '		</div><!-- /.info-box-lines --></div><!-- /.info-box-content -->'."\n";
580
+                $openedDashBoard .= '	</div><!-- /.info-box -->'."\n";
581
+                $openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
582
+                $openedDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
583
+                $openedDashBoard .= "\n";
584
+            }
585
+        }
586
+
587
+        if ($showweather && !empty($isIntopOpenedDashBoard)) {
588
+            $appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '');
589
+            $weather = getWeatherStatus($totallate);
590
+
591
+            $text = '';
592
+            if ($totallate > 0) {
593
+                $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
594
+                    "NActionsLate",
595
+                    $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
596
+                ).')';
597
+            } else {
598
+                $text = $langs->transnoentitiesnoconv("NoItemLate");
599
+            }
600
+            $text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
601
+
602
+            $weatherDashBoard = '<div class="box-flex-item '.$appendClass.'"><div class="box-flex-item-with-margin">'."\n";
603
+            $weatherDashBoard .= '	<div class="info-box '.$openedDashBoardSize.' info-box-weather info-box-weather-level'.$weather->level.'">'."\n";
604
+            $weatherDashBoard .= '		<span class="info-box-icon">';
605
+            $weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50');
606
+            $weatherDashBoard .= '       </span>'."\n";
607
+            $weatherDashBoard .= '		<div class="info-box-content">'."\n";
608
+            $weatherDashBoard .= '			<div class="info-box-title">'.$langs->trans('GlobalOpenedElemView').'</div>'."\n";
609
+
610
+            if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
611
+                $weatherDashBoard .= '			<span class="info-box-number">'.$langs->transnoentitiesnoconv(
612
+                    "NActionsLate",
613
+                    price($totallatePercentage).'%'
614
+                ).'</span>'."\n";
615
+                $weatherDashBoard .= '			<span class="progress-description">'.$langs->trans(
616
+                    'NActionsLate',
617
+                    $totalLateNumber
618
+                ).'</span>'."\n";
619
+            } else {
620
+                $weatherDashBoard .= '			<span class="info-box-number">'.$langs->transnoentitiesnoconv(
621
+                    "NActionsLate",
622
+                    $totalLateNumber
623
+                ).'</span>'."\n";
624
+                if ($totallatePercentage > 0) {
625
+                    $weatherDashBoard .= '			<span class="progress-description">'.$langs->trans(
626
+                        'NActionsLate',
627
+                        price($totallatePercentage).'%'
628
+                    ).'</span>'."\n";
629
+                }
630
+            }
631
+
632
+            $weatherDashBoard .= '		</div><!-- /.info-box-content -->'."\n";
633
+            $weatherDashBoard .= '	</div><!-- /.info-box -->'."\n";
634
+            $weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
635
+            $weatherDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
636
+            $weatherDashBoard .= "\n";
637
+
638
+            $openedDashBoard = $weatherDashBoard.$openedDashBoard;
639
+        }
640
+
641
+        if (!empty($isIntopOpenedDashBoard)) {
642
+            for ($i = 1; $i <= 10; $i++) {
643
+                $openedDashBoard .= '<div class="box-flex-item filler"></div>';
644
+            }
645
+        }
646
+
647
+        $nbworkboardcount = 0;
648
+        foreach ($valid_dashboardlines as $infoKey => $board) {
649
+            if (in_array($infoKey, $isIntopOpenedDashBoard)) {
650
+                // skip if info is present on top
651
+                continue;
652
+            }
653
+
654
+            if (empty($board->nbtodo)) {
655
+                $nbworkboardempty++;
656
+            }
657
+            $nbworkboardcount++;
658
+
659
+
660
+            $textlate = $langs->trans("NActionsLate", $board->nbtodolate);
661
+            $textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
662
+
663
+
664
+            $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">';
665
+            $boxwork .= '<div class="boxstatscontent">';
666
+            $boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' <span>'.$board->label.'</span></span><br>';
667
+            $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>';
668
+            if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
669
+                $boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>';
670
+            }
671
+            $boxwork .= '</div>';
672
+            if ($board->nbtodolate > 0) {
673
+                $boxwork .= '<div class="dashboardlinelatecoin nowrap">';
674
+                $boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
675
+                //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
676
+                $boxwork .= img_picto(
677
+                    $textlate,
678
+                    "warning_white",
679
+                    'class="inline-block hideonsmartphone valigntextbottom"'
680
+                ).'';
681
+                $boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
682
+                $boxwork .= $board->nbtodolate;
683
+                $boxwork .= '</span>';
684
+                $boxwork .= '</a>';
685
+                $boxwork .= '</div>';
686
+            }
687
+            $boxwork .= '</div></div>';
688
+            $boxwork .= "\n";
689
+        }
690
+
691
+        $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
692
+        $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
693
+        $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
694
+        $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>';
695
+
696
+        $boxwork .= '</div>';
697
+        $boxwork .= '</td></tr>';
698
+    } else {
699
+        $boxwork .= '<tr class="nohover">';
700
+        $boxwork .= '<td class="nohover valignmiddle opacitymedium">';
701
+        $boxwork .= $langs->trans("NoOpenedElementToProcess");
702
+        $boxwork .= '</td>';
703
+        $boxwork .= '</tr>';
704
+    }
705
+
706
+    $boxwork .= '</td></tr>';
707
+
708
+    $boxwork .= '</table>'; // End table array of working board
709
+    $boxwork .= '</div>';
710
+
711
+    if (!empty($isIntopOpenedDashBoard)) {
712
+        print '<div class="fichecenter">';
713
+        print '<div class="opened-dash-board-wrap"><div class="box-flex-container">'.$openedDashBoard.'</div></div>';
714
+        print '</div>';
715
+    }
716 716
 }
717 717
 
718 718
 
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
731 731
 if (!empty($nbworkboardcount)) {
732
-	$boxlist .= $boxwork;
732
+    $boxlist .= $boxwork;
733 733
 }
734 734
 
735 735
 $boxlist .= $resultboxes['boxlista'];
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
  */
770 770
 function showWeather($totallate, $text, $options, $morecss = '')
771 771
 {
772
-	global $conf;
772
+    global $conf;
773 773
 
774
-	$weather = getWeatherStatus($totallate);
775
-	return img_weather($text, $weather->picto, $options, 0, $morecss);
774
+    $weather = getWeatherStatus($totallate);
775
+    return img_weather($text, $weather->picto, $options, 0, $morecss);
776 776
 }
777 777
 
778 778
 
@@ -785,50 +785,50 @@  discard block
 block discarded – undo
785 785
  */
786 786
 function getWeatherStatus($totallate)
787 787
 {
788
-	global $conf;
789
-
790
-	$weather = new stdClass();
791
-	$weather->picto = '';
792
-
793
-	$offset = 0;
794
-	$factor = 10; // By default
795
-
796
-	$used_conf = empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_LEVEL' : 'MAIN_METEO_PERCENTAGE_LEVEL';
797
-
798
-	$level0 = $offset;
799
-	$weather->level = 0;
800
-	if (!empty($conf->global->{$used_conf.'0'})) {
801
-		$level0 = $conf->global->{$used_conf.'0'};
802
-	}
803
-	$level1 = $offset + 1 * $factor;
804
-	if (!empty($conf->global->{$used_conf.'1'})) {
805
-		$level1 = $conf->global->{$used_conf.'1'};
806
-	}
807
-	$level2 = $offset + 2 * $factor;
808
-	if (!empty($conf->global->{$used_conf.'2'})) {
809
-		$level2 = $conf->global->{$used_conf.'2'};
810
-	}
811
-	$level3 = $offset + 3 * $factor;
812
-	if (!empty($conf->global->{$used_conf.'3'})) {
813
-		$level3 = $conf->global->{$used_conf.'3'};
814
-	}
815
-
816
-	if ($totallate <= $level0) {
817
-		$weather->picto = 'weather-clear.png';
818
-		$weather->level = 0;
819
-	} elseif ($totallate <= $level1) {
820
-		$weather->picto = 'weather-few-clouds.png';
821
-		$weather->level = 1;
822
-	} elseif ($totallate <= $level2) {
823
-		$weather->picto = 'weather-clouds.png';
824
-		$weather->level = 2;
825
-	} elseif ($totallate <= $level3) {
826
-		$weather->picto = 'weather-many-clouds.png';
827
-		$weather->level = 3;
828
-	} else {
829
-		$weather->picto = 'weather-storm.png';
830
-		$weather->level = 4;
831
-	}
832
-
833
-	return $weather;
788
+    global $conf;
789
+
790
+    $weather = new stdClass();
791
+    $weather->picto = '';
792
+
793
+    $offset = 0;
794
+    $factor = 10; // By default
795
+
796
+    $used_conf = empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_LEVEL' : 'MAIN_METEO_PERCENTAGE_LEVEL';
797
+
798
+    $level0 = $offset;
799
+    $weather->level = 0;
800
+    if (!empty($conf->global->{$used_conf.'0'})) {
801
+        $level0 = $conf->global->{$used_conf.'0'};
802
+    }
803
+    $level1 = $offset + 1 * $factor;
804
+    if (!empty($conf->global->{$used_conf.'1'})) {
805
+        $level1 = $conf->global->{$used_conf.'1'};
806
+    }
807
+    $level2 = $offset + 2 * $factor;
808
+    if (!empty($conf->global->{$used_conf.'2'})) {
809
+        $level2 = $conf->global->{$used_conf.'2'};
810
+    }
811
+    $level3 = $offset + 3 * $factor;
812
+    if (!empty($conf->global->{$used_conf.'3'})) {
813
+        $level3 = $conf->global->{$used_conf.'3'};
814
+    }
815
+
816
+    if ($totallate <= $level0) {
817
+        $weather->picto = 'weather-clear.png';
818
+        $weather->level = 0;
819
+    } elseif ($totallate <= $level1) {
820
+        $weather->picto = 'weather-few-clouds.png';
821
+        $weather->level = 1;
822
+    } elseif ($totallate <= $level2) {
823
+        $weather->picto = 'weather-clouds.png';
824
+        $weather->level = 2;
825
+    } elseif ($totallate <= $level3) {
826
+        $weather->picto = 'weather-many-clouds.png';
827
+        $weather->level = 3;
828
+    } else {
829
+        $weather->picto = 'weather-storm.png';
830
+        $weather->level = 4;
831
+    }
832
+
833
+    return $weather;
834 834
 }
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
  *	\brief      Dolibarr home page
26 26
  */
27 27
 
28
-define('CSRFCHECK_WITH_TOKEN', 1);	// We force need to use a token to login when making a POST
28
+define('CSRFCHECK_WITH_TOKEN', 1); // We force need to use a token to login when making a POST
29 29
 
30 30
 require 'main.inc.php';
31
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
32 32
 
33 33
 // If not defined, we select menu "home"
34 34
 $_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 
43 43
 // Check if company name is defined (first install)
44 44
 if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
45
-	header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
45
+	header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
46 46
 	exit;
47 47
 }
48 48
 if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) {	// If only user module enabled
49
-	header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
49
+	header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
50 50
 	exit;
51 51
 }
52 52
 if (GETPOST('addbox')) {	// Add box (when submit is done from a form when ajax disabled)
53
-	require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
53
+	require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
54 54
 	$zone = GETPOST('areacode', 'int');
55 55
 	$userid = GETPOST('userid', 'int');
56 56
 	$boxorder = GETPOST('boxorder', 'aZ09');
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 }
73 73
 
74 74
 // Title
75
-$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
75
+$title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION;
76 76
 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
77
-	$title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
77
+	$title = $langs->trans("HomeArea") . ' - ' . $conf->global->MAIN_APPLICATION_TITLE;
78 78
 }
79 79
 
80 80
 llxHeader('', $title);
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	$message = '';
110 110
 
111 111
 	// Check if install lock file is present
112
-	$lockfile = DOL_DATA_ROOT.'/install.lock';
113
-	if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
112
+	$lockfile = DOL_DATA_ROOT . '/install.lock';
113
+	if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) {
114 114
 		$langs->load("errors");
115 115
 		//if (! empty($message)) $message.='<br>';
116
-		$message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
116
+		$message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth');
117 117
 	}
118 118
 
119 119
 	// Conf files must be in read only mode
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$langs->load("errors");
122 122
 		//$langs->load("other");
123 123
 		//if (! empty($message)) $message.='<br>';
124
-		$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
124
+		$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth');
125 125
 	}
126 126
 
127 127
 	if ($message) {
@@ -151,97 +151,97 @@  discard block
 block discarded – undo
151 151
 	$dashboardlines = array();
152 152
 
153 153
 	// Do not include sections without management permission
154
-	require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
154
+	require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php';
155 155
 
156 156
 	// Number of actions to do (late)
157 157
 	if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
158
-		include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
158
+		include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
159 159
 		$board = new ActionComm($db);
160 160
 		$dashboardlines[$board->element] = $board->load_board($user);
161 161
 	}
162 162
 
163 163
 	// Number of project opened
164 164
 	if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
165
-		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
165
+		include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
166 166
 		$board = new Project($db);
167 167
 		$dashboardlines[$board->element] = $board->load_board($user);
168 168
 	}
169 169
 
170 170
 	// Number of tasks to do (late)
171 171
 	if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
172
-		include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
172
+		include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
173 173
 		$board = new Task($db);
174 174
 		$dashboardlines[$board->element] = $board->load_board($user);
175 175
 	}
176 176
 
177 177
 	// Number of commercial proposals open (expired)
178 178
 	if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
179
-		include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
179
+		include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
180 180
 		$board = new Propal($db);
181
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
181
+		$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
182 182
 		// Number of commercial proposals CLOSED signed (billed)
183
-		$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
183
+		$dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed");
184 184
 	}
185 185
 
186 186
 	// Number of commercial proposals open (expired)
187 187
 	if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
188
-		include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
188
+		include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
189 189
 		$board = new SupplierProposal($db);
190
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
190
+		$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
191 191
 		// Number of commercial proposals CLOSED signed (billed)
192
-		$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
192
+		$dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed");
193 193
 	}
194 194
 
195 195
 	// Number of customer orders a deal
196 196
 	if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
197
-		include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
197
+		include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
198 198
 		$board = new Commande($db);
199 199
 		$dashboardlines[$board->element] = $board->load_board($user);
200 200
 	}
201 201
 
202 202
 	// Number of suppliers orders a deal
203 203
 	if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
204
-		include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
204
+		include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
205 205
 		$board = new CommandeFournisseur($db);
206
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
207
-		$dashboardlines[$board->element.'_awaiting'] = $board->load_board($user, 'awaiting');
206
+		$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
207
+		$dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting');
208 208
 	}
209 209
 
210 210
 	// Number of contract / services enabled (delayed)
211 211
 	if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
212
-		include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
212
+		include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
213 213
 		$board = new Contrat($db);
214
-		$dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive");
214
+		$dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive");
215 215
 		// Number of active services (expired)
216
-		$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
216
+		$dashboardlines[$board->element . '_active'] = $board->load_board($user, "active");
217 217
 	}
218 218
 
219 219
 	// Number of tickets open
220 220
 	if (!empty($conf->ticket->enabled) && $user->rights->ticket->read) {
221
-		include_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
221
+		include_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
222 222
 		$board = new Ticket($db);
223
-		$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
223
+		$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
224 224
 		// Number of active services (expired)
225 225
 		//$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
226 226
 	}
227 227
 
228 228
 	// Number of invoices customers (paid)
229 229
 	if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
230
-		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
230
+		include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
231 231
 		$board = new Facture($db);
232 232
 		$dashboardlines[$board->element] = $board->load_board($user);
233 233
 	}
234 234
 
235 235
 	// Number of supplier invoices (paid)
236 236
 	if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
237
-		include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
237
+		include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
238 238
 		$board = new FactureFournisseur($db);
239 239
 		$dashboardlines[$board->element] = $board->load_board($user);
240 240
 	}
241 241
 
242 242
 	// Number of transactions to conciliate
243 243
 	if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) {
244
-		include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
244
+		include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
245 245
 		$board = new Account($db);
246 246
 		$nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate
247 247
 		if ($nb > 0) {
@@ -251,36 +251,36 @@  discard block
 block discarded – undo
251 251
 
252 252
 	// Number of cheque to send
253 253
 	if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
254
-		include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
254
+		include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
255 255
 		$board = new RemiseCheque($db);
256 256
 		$dashboardlines[$board->element] = $board->load_board($user);
257 257
 	}
258 258
 
259 259
 	// Number of foundation members
260 260
 	if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
261
-		include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
261
+		include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
262 262
 		$board = new Adherent($db);
263
-		$dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift');
264
-		$dashboardlines[$board->element.'_expired'] = $board->load_board($user, 'expired');
263
+		$dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift');
264
+		$dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired');
265 265
 	}
266 266
 
267 267
 	// Number of expense reports to approve
268 268
 	if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
269
-		include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
269
+		include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
270 270
 		$board = new ExpenseReport($db);
271
-		$dashboardlines[$board->element.'_toapprove'] = $board->load_board($user, 'toapprove');
271
+		$dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove');
272 272
 	}
273 273
 
274 274
 	// Number of expense reports to pay
275 275
 	if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
276
-		include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
276
+		include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
277 277
 		$board = new ExpenseReport($db);
278
-		$dashboardlines[$board->element.'_topay'] = $board->load_board($user, 'topay');
278
+		$dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay');
279 279
 	}
280 280
 
281 281
 	// Number of holidays to approve
282 282
 	if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
283
-		include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
283
+		include_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';
284 284
 		$board = new Holiday($db);
285 285
 		$dashboardlines[$board->element] = $board->load_board($user);
286 286
 	}
@@ -443,25 +443,25 @@  discard block
 block discarded – undo
443 443
 
444 444
 	$boxwork = '';
445 445
 	$boxwork .= '<div class="box">';
446
-	$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">'."\n";
446
+	$boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">' . "\n";
447 447
 	$boxwork .= '<tr class="liste_titre">';
448
-	$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
448
+	$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">' . $langs->trans("DolibarrWorkBoard") . '</div>';
449 449
 	if ($showweather) {
450 450
 		if ($totallate > 0) {
451
-			$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
451
+			$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv(
452 452
 				"NActionsLate",
453
-				$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
454
-			).')';
453
+				$totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
454
+			) . ')';
455 455
 		} else {
456 456
 			$text = $langs->transnoentitiesnoconv("NoItemLate");
457 457
 		}
458
-		$text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
458
+		$text .= '. ' . $langs->transnoentitiesnoconv("LateDesc");
459 459
 		//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
460 460
 		$options = 'height="24px" style="float: right"';
461 461
 		$boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle');
462 462
 	}
463 463
 	$boxwork .= '</th>';
464
-	$boxwork .= '</tr>'."\n";
464
+	$boxwork .= '</tr>' . "\n";
465 465
 
466 466
 	// Show dashboard
467 467
 	$nbworkboardempty = 0;
@@ -502,52 +502,52 @@  discard block
 block discarded – undo
502 502
 							$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
503 503
 							$nbTotal = floatval($groupElement['globalStats']['total']);
504 504
 							if ($nbTotal >= 10000) {
505
-								$nbTotal = round($nbTotal / 1000, 2).'k';
505
+								$nbTotal = round($nbTotal / 1000, 2) . 'k';
506 506
 							}
507
-							$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
507
+							$groupElement['globalStats']['text'] = $langs->trans('Total') . ' : ' . $langs->trans($titres[$keyIndex]) . ' (' . $groupElement['globalStats']['total'] . ')';
508 508
 							$groupElement['globalStats']['total'] = $nbTotal;
509 509
 							$groupElement['globalStats']['link'] = $links[$keyIndex];
510 510
 						}
511 511
 					}
512 512
 				}
513 513
 
514
-				$openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">'."\n";
515
-				$openedDashBoard .= '	<div class="info-box '.$openedDashBoardSize.'">'."\n";
516
-				$openedDashBoard .= '		<span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n";
517
-				$openedDashBoard .= '		<i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
514
+				$openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">' . "\n";
515
+				$openedDashBoard .= '	<div class="info-box ' . $openedDashBoardSize . '">' . "\n";
516
+				$openedDashBoard .= '		<span class="info-box-icon bg-infobox-' . $groupKeyLowerCase . '">' . "\n";
517
+				$openedDashBoard .= '		<i class="fa fa-dol-' . $groupKeyLowerCase . '"></i>' . "\n";
518 518
 
519 519
 				// Show the span for the total of record
520 520
 				if (!empty($groupElement['globalStats'])) {
521 521
 					$globalStatInTopOpenedDashBoard[] = $globalStatsKey;
522
-					$openedDashBoard .= '<span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>';
522
+					$openedDashBoard .= '<span class="info-box-icon-text" title="' . $groupElement['globalStats']['text'] . '">' . $nbTotal . '</span>';
523 523
 				}
524 524
 
525
-				$openedDashBoard .= '</span>'."\n";
526
-				$openedDashBoard .= '<div class="info-box-content">'."\n";
525
+				$openedDashBoard .= '</span>' . "\n";
526
+				$openedDashBoard .= '<div class="info-box-content">' . "\n";
527 527
 
528
-				$openedDashBoard .= '<div class="info-box-title" title="'.strip_tags($groupName).'">'.$groupName.'</div>'."\n";
529
-				$openedDashBoard .= '<div class="info-box-lines">'."\n";
528
+				$openedDashBoard .= '<div class="info-box-title" title="' . strip_tags($groupName) . '">' . $groupName . '</div>' . "\n";
529
+				$openedDashBoard .= '<div class="info-box-lines">' . "\n";
530 530
 
531 531
 				foreach ($boards as $board) {
532 532
 					$openedDashBoard .= '<div class="info-box-line">';
533 533
 
534 534
 					if (!empty($board->labelShort)) {
535
-						$infoName = '<span title="'.$board->label.'">'.$board->labelShort.'</span>';
535
+						$infoName = '<span title="' . $board->label . '">' . $board->labelShort . '</span>';
536 536
 					} else {
537 537
 						$infoName = $board->label;
538 538
 					}
539 539
 
540 540
 					$textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate);
541
-					$textLateTitle .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
541
+					$textLateTitle .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')';
542 542
 
543 543
 					if ($board->id == 'bank_account') {
544
-						$textLateTitle .= '<br><span class="opacitymedium">'.$langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")).'</span>';
544
+						$textLateTitle .= '<br><span class="opacitymedium">' . $langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")) . '</span>';
545 545
 					}
546 546
 
547 547
 					$textLate = '';
548 548
 					if ($board->nbtodolate > 0) {
549
-						$textLate .= '<span title="'.dol_escape_htmltag($textLateTitle).'" class="classfortooltip badge badge-warning">';
550
-						$textLate .= '<i class="fa fa-exclamation-triangle"></i> '.$board->nbtodolate;
549
+						$textLate .= '<span title="' . dol_escape_htmltag($textLateTitle) . '" class="classfortooltip badge badge-warning">';
550
+						$textLate .= '<i class="fa fa-exclamation-triangle"></i> ' . $board->nbtodolate;
551 551
 						$textLate .= '</span>';
552 552
 					}
553 553
 
@@ -556,30 +556,30 @@  discard block
 block discarded – undo
556 556
 						$nbtodClass = 'badge badge-info';
557 557
 					}
558 558
 
559
-					$openedDashBoard .= '			<a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
559
+					$openedDashBoard .= '			<a href="' . $board->url . '" class="info-box-text info-box-text-a">' . $infoName . ' : <span class="' . $nbtodClass . ' classfortooltip" title="' . $board->label . '" >' . $board->nbtodo . '</span>';
560 560
 					if ($textLate) {
561 561
 						if ($board->url_late) {
562 562
 							$openedDashBoard .= '</a>';
563
-							$openedDashBoard .= ' <a href="'.$board->url_late.'" class="info-box-text info-box-text-a paddingleft">';
563
+							$openedDashBoard .= ' <a href="' . $board->url_late . '" class="info-box-text info-box-text-a paddingleft">';
564 564
 						} else {
565 565
 							$openedDashBoard .= ' ';
566 566
 						}
567 567
 						$openedDashBoard .= $textLate;
568 568
 					}
569
-					$openedDashBoard .= '</a>'."\n";
569
+					$openedDashBoard .= '</a>' . "\n";
570 570
 
571 571
 					if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
572
-						$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
572
+						$openedDashBoard .= '<a href="' . $board->url . '" class="info-box-text">' . $langs->trans('Total') . ' : ' . price($board->total) . '</a>';
573 573
 					}
574
-					$openedDashBoard .= '</div>'."\n";
574
+					$openedDashBoard .= '</div>' . "\n";
575 575
 				}
576 576
 
577 577
 				// TODO Add hook here to add more "info-box-line"
578 578
 
579
-				$openedDashBoard .= '		</div><!-- /.info-box-lines --></div><!-- /.info-box-content -->'."\n";
580
-				$openedDashBoard .= '	</div><!-- /.info-box -->'."\n";
581
-				$openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
582
-				$openedDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
579
+				$openedDashBoard .= '		</div><!-- /.info-box-lines --></div><!-- /.info-box-content -->' . "\n";
580
+				$openedDashBoard .= '	</div><!-- /.info-box -->' . "\n";
581
+				$openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->' . "\n";
582
+				$openedDashBoard .= '</div><!-- /.box-flex-item -->' . "\n";
583 583
 				$openedDashBoard .= "\n";
584 584
 			}
585 585
 		}
@@ -590,52 +590,52 @@  discard block
 block discarded – undo
590 590
 
591 591
 			$text = '';
592 592
 			if ($totallate > 0) {
593
-				$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
593
+				$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv(
594 594
 					"NActionsLate",
595
-					$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
596
-				).')';
595
+					$totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
596
+				) . ')';
597 597
 			} else {
598 598
 				$text = $langs->transnoentitiesnoconv("NoItemLate");
599 599
 			}
600
-			$text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
600
+			$text .= '. ' . $langs->transnoentitiesnoconv("LateDesc");
601 601
 
602
-			$weatherDashBoard = '<div class="box-flex-item '.$appendClass.'"><div class="box-flex-item-with-margin">'."\n";
603
-			$weatherDashBoard .= '	<div class="info-box '.$openedDashBoardSize.' info-box-weather info-box-weather-level'.$weather->level.'">'."\n";
602
+			$weatherDashBoard = '<div class="box-flex-item ' . $appendClass . '"><div class="box-flex-item-with-margin">' . "\n";
603
+			$weatherDashBoard .= '	<div class="info-box ' . $openedDashBoardSize . ' info-box-weather info-box-weather-level' . $weather->level . '">' . "\n";
604 604
 			$weatherDashBoard .= '		<span class="info-box-icon">';
605 605
 			$weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50');
606
-			$weatherDashBoard .= '       </span>'."\n";
607
-			$weatherDashBoard .= '		<div class="info-box-content">'."\n";
608
-			$weatherDashBoard .= '			<div class="info-box-title">'.$langs->trans('GlobalOpenedElemView').'</div>'."\n";
606
+			$weatherDashBoard .= '       </span>' . "\n";
607
+			$weatherDashBoard .= '		<div class="info-box-content">' . "\n";
608
+			$weatherDashBoard .= '			<div class="info-box-title">' . $langs->trans('GlobalOpenedElemView') . '</div>' . "\n";
609 609
 
610 610
 			if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
611
-				$weatherDashBoard .= '			<span class="info-box-number">'.$langs->transnoentitiesnoconv(
611
+				$weatherDashBoard .= '			<span class="info-box-number">' . $langs->transnoentitiesnoconv(
612 612
 					"NActionsLate",
613
-					price($totallatePercentage).'%'
614
-				).'</span>'."\n";
615
-				$weatherDashBoard .= '			<span class="progress-description">'.$langs->trans(
613
+					price($totallatePercentage) . '%'
614
+				) . '</span>' . "\n";
615
+				$weatherDashBoard .= '			<span class="progress-description">' . $langs->trans(
616 616
 					'NActionsLate',
617 617
 					$totalLateNumber
618
-				).'</span>'."\n";
618
+				) . '</span>' . "\n";
619 619
 			} else {
620
-				$weatherDashBoard .= '			<span class="info-box-number">'.$langs->transnoentitiesnoconv(
620
+				$weatherDashBoard .= '			<span class="info-box-number">' . $langs->transnoentitiesnoconv(
621 621
 					"NActionsLate",
622 622
 					$totalLateNumber
623
-				).'</span>'."\n";
623
+				) . '</span>' . "\n";
624 624
 				if ($totallatePercentage > 0) {
625
-					$weatherDashBoard .= '			<span class="progress-description">'.$langs->trans(
625
+					$weatherDashBoard .= '			<span class="progress-description">' . $langs->trans(
626 626
 						'NActionsLate',
627
-						price($totallatePercentage).'%'
628
-					).'</span>'."\n";
627
+						price($totallatePercentage) . '%'
628
+					) . '</span>' . "\n";
629 629
 				}
630 630
 			}
631 631
 
632
-			$weatherDashBoard .= '		</div><!-- /.info-box-content -->'."\n";
633
-			$weatherDashBoard .= '	</div><!-- /.info-box -->'."\n";
634
-			$weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
635
-			$weatherDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
632
+			$weatherDashBoard .= '		</div><!-- /.info-box-content -->' . "\n";
633
+			$weatherDashBoard .= '	</div><!-- /.info-box -->' . "\n";
634
+			$weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->' . "\n";
635
+			$weatherDashBoard .= '</div><!-- /.box-flex-item -->' . "\n";
636 636
 			$weatherDashBoard .= "\n";
637 637
 
638
-			$openedDashBoard = $weatherDashBoard.$openedDashBoard;
638
+			$openedDashBoard = $weatherDashBoard . $openedDashBoard;
639 639
 		}
640 640
 
641 641
 		if (!empty($isIntopOpenedDashBoard)) {
@@ -658,27 +658,27 @@  discard block
 block discarded – undo
658 658
 
659 659
 
660 660
 			$textlate = $langs->trans("NActionsLate", $board->nbtodolate);
661
-			$textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
661
+			$textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')';
662 662
 
663 663
 
664 664
 			$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">';
665 665
 			$boxwork .= '<div class="boxstatscontent">';
666
-			$boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' <span>'.$board->label.'</span></span><br>';
667
-			$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>';
666
+			$boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' <span>' . $board->label . '</span></span><br>';
667
+			$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>';
668 668
 			if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
669
-				$boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>';
669
+				$boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>';
670 670
 			}
671 671
 			$boxwork .= '</div>';
672 672
 			if ($board->nbtodolate > 0) {
673 673
 				$boxwork .= '<div class="dashboardlinelatecoin nowrap">';
674
-				$boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
674
+				$boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late) . '">';
675 675
 				//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
676 676
 				$boxwork .= img_picto(
677 677
 					$textlate,
678 678
 					"warning_white",
679 679
 					'class="inline-block hideonsmartphone valigntextbottom"'
680
-				).'';
681
-				$boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
680
+				) . '';
681
+				$boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">';
682 682
 				$boxwork .= $board->nbtodolate;
683 683
 				$boxwork .= '</span>';
684 684
 				$boxwork .= '</a>';
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 
711 711
 	if (!empty($isIntopOpenedDashBoard)) {
712 712
 		print '<div class="fichecenter">';
713
-		print '<div class="opened-dash-board-wrap"><div class="box-flex-container">'.$openedDashBoard.'</div></div>';
713
+		print '<div class="opened-dash-board-wrap"><div class="box-flex-container">' . $openedDashBoard . '</div></div>';
714 714
 		print '</div>';
715 715
 	}
716 716
 }
@@ -797,20 +797,20 @@  discard block
 block discarded – undo
797 797
 
798 798
 	$level0 = $offset;
799 799
 	$weather->level = 0;
800
-	if (!empty($conf->global->{$used_conf.'0'})) {
801
-		$level0 = $conf->global->{$used_conf.'0'};
800
+	if (!empty($conf->global->{$used_conf . '0'})) {
801
+		$level0 = $conf->global->{$used_conf . '0'};
802 802
 	}
803 803
 	$level1 = $offset + 1 * $factor;
804
-	if (!empty($conf->global->{$used_conf.'1'})) {
805
-		$level1 = $conf->global->{$used_conf.'1'};
804
+	if (!empty($conf->global->{$used_conf . '1'})) {
805
+		$level1 = $conf->global->{$used_conf . '1'};
806 806
 	}
807 807
 	$level2 = $offset + 2 * $factor;
808
-	if (!empty($conf->global->{$used_conf.'2'})) {
809
-		$level2 = $conf->global->{$used_conf.'2'};
808
+	if (!empty($conf->global->{$used_conf . '2'})) {
809
+		$level2 = $conf->global->{$used_conf . '2'};
810 810
 	}
811 811
 	$level3 = $offset + 3 * $factor;
812
-	if (!empty($conf->global->{$used_conf.'3'})) {
813
-		$level3 = $conf->global->{$used_conf.'3'};
812
+	if (!empty($conf->global->{$used_conf . '3'})) {
813
+		$level3 = $conf->global->{$used_conf . '3'};
814 814
 	}
815 815
 
816 816
 	if ($totallate <= $level0) {
Please login to merge, or discard this patch.
htdocs/Core/DebugBarCollectors/PhpCollector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     {
65 65
         $messages = $this->messages;
66 66
 
67
-        usort($messages, function ($itemA, $itemB) {
67
+        usort($messages, function($itemA, $itemB) {
68 68
             if ($itemA['time'] === $itemB['time']) {
69 69
                 return 0;
70 70
             }
Please login to merge, or discard this patch.
htdocs/Core/Utils/FileSystemUtils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
         $modules = [];
109 109
         foreach (ModuleManager::getEnabledModules() as $value) {
110 110
             $cad = $value['path'];
111
-            $modules[] = substr($cad, strlen('src/'));    // Delete initial 'src\'
111
+            $modules[] = substr($cad, strlen('src/')); // Delete initial 'src\'
112 112
         }
113 113
         $modules[] = 'Alxarafe\Core';
114 114
         foreach ($modules as $module) {
Please login to merge, or discard this patch.
htdocs/Core/Helpers/Auth.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@
 block discarded – undo
124 124
      */
125 125
     public function setUser($user, $password)
126 126
     {
127
-        $username_field = 'login';  // Alxarafe use 'username', but Dolibarr use 'login'
128
-        $password_field = 'pass_crypted';  // Alxarafe use 'password', but Dolibarr use 'pass_crypted'
127
+        $username_field = 'login'; // Alxarafe use 'username', but Dolibarr use 'login'
128
+        $password_field = 'pass_crypted'; // Alxarafe use 'password', but Dolibarr use 'pass_crypted'
129 129
         $encrypt_method = "password_hash"; // Alxarafe use 'md5', but Dolibarr use a function called dol_hash
130 130
 
131 131
         $_user = Engine::select("SELECT * FROM {$this->users->tableName} WHERE $username_field='$user';");
Please login to merge, or discard this patch.