@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
48 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
49 | 49 | /** |
50 | 50 | * SetOpenIDServer |
51 | 51 | * |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function SetOpenIDServer($a) |
56 | 56 | { |
57 | - // phpcs:enable |
|
57 | + // phpcs:enable |
|
58 | 58 | $this->URLs['openid_server'] = $a; |
59 | 59 | } |
60 | 60 | |
61 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
61 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
62 | 62 | /** |
63 | 63 | * SetOpenIDServer |
64 | 64 | * |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function SetTrustRoot($a) |
69 | 69 | { |
70 | - // phpcs:enable |
|
70 | + // phpcs:enable |
|
71 | 71 | $this->URLs['trust_root'] = $a; |
72 | 72 | } |
73 | 73 | |
74 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
74 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
75 | 75 | /** |
76 | 76 | * SetOpenIDServer |
77 | 77 | * |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function SetCancelURL($a) |
82 | 82 | { |
83 | - // phpcs:enable |
|
83 | + // phpcs:enable |
|
84 | 84 | $this->URLs['cancel'] = $a; |
85 | 85 | } |
86 | 86 | |
87 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
87 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
88 | 88 | /** |
89 | 89 | * SetApprovedURL |
90 | 90 | * |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function SetApprovedURL($a) |
95 | 95 | { |
96 | - // phpcs:enable |
|
96 | + // phpcs:enable |
|
97 | 97 | $this->URLs['approved'] = $a; |
98 | 98 | } |
99 | 99 | |
100 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
100 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
101 | 101 | /** |
102 | 102 | * SetRequiredFields |
103 | 103 | * |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function SetRequiredFields($a) |
108 | 108 | { |
109 | - // phpcs:enable |
|
109 | + // phpcs:enable |
|
110 | 110 | if (is_array($a)) { |
111 | 111 | $this->fields['required'] = $a; |
112 | 112 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
117 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
118 | 118 | /** |
119 | 119 | * SetOptionalFields |
120 | 120 | * |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function SetOptionalFields($a) |
125 | 125 | { |
126 | - // phpcs:enable |
|
126 | + // phpcs:enable |
|
127 | 127 | if (is_array($a)) { |
128 | 128 | $this->fields['optional'] = $a; |
129 | 129 | } else { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
134 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
135 | 135 | /** |
136 | 136 | * SetIdentity |
137 | 137 | * |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function SetIdentity($a) |
142 | 142 | { |
143 | - // phpcs:enable |
|
143 | + // phpcs:enable |
|
144 | 144 | // Set Identity URL |
145 | 145 | if ( |
146 | 146 | (stripos($a, 'http://') === false) |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $this->openid_url_identity = $a; |
165 | 165 | } |
166 | 166 | |
167 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
167 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
168 | 168 | /** |
169 | 169 | * GetIdentity |
170 | 170 | * |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function GetIdentity() |
174 | 174 | { |
175 | - // phpcs:enable |
|
175 | + // phpcs:enable |
|
176 | 176 | // Get Identity |
177 | 177 | return $this->openid_url_identity; |
178 | 178 | } |
179 | 179 | |
180 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
180 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
181 | 181 | /** |
182 | 182 | * SetOpenIDServer |
183 | 183 | * |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function GetError() |
187 | 187 | { |
188 | - // phpcs:enable |
|
188 | + // phpcs:enable |
|
189 | 189 | $e = $this->error; |
190 | 190 | return array('code' => $e[0], 'description' => $e[1]); |
191 | 191 | } |
192 | 192 | |
193 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
193 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
194 | 194 | /** |
195 | 195 | * ErrorStore |
196 | 196 | * |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function ErrorStore($code, $desc = null) |
202 | 202 | { |
203 | - // phpcs:enable |
|
203 | + // phpcs:enable |
|
204 | 204 | $errs = array(); |
205 | 205 | $errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.'; |
206 | 206 | if ($desc == null) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $this->error = array($code, $desc); |
210 | 210 | } |
211 | 211 | |
212 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
212 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
213 | 213 | /** |
214 | 214 | * IsError |
215 | 215 | * |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function IsError() |
219 | 219 | { |
220 | - // phpcs:enable |
|
220 | + // phpcs:enable |
|
221 | 221 | if (count($this->error) > 0) { |
222 | 222 | return true; |
223 | 223 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return $r; |
246 | 246 | } |
247 | 247 | |
248 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
248 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
249 | 249 | /** |
250 | 250 | * OpenID_Standarize |
251 | 251 | * |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function OpenID_Standarize($openid_identity = null) |
256 | 256 | { |
257 | - // phpcs:enable |
|
257 | + // phpcs:enable |
|
258 | 258 | if ($openid_identity === null) { |
259 | 259 | $openid_identity = $this->openid_url_identity; |
260 | 260 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | return $query; |
294 | 294 | } |
295 | 295 | |
296 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
296 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
297 | 297 | /** |
298 | 298 | * FSOCK_Request |
299 | 299 | * |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function FSOCK_Request($url, $method = "GET", $params = "") |
306 | 306 | { |
307 | - // phpcs:enable |
|
307 | + // phpcs:enable |
|
308 | 308 | $fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds |
309 | 309 | if (!$fp) { |
310 | 310 | $this->ErrorStore('OPENID_SOCKETERROR', $errstr); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
330 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
331 | 331 | /** |
332 | 332 | * HTML2OpenIDServer |
333 | 333 | * |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | */ |
337 | 337 | public function HTML2OpenIDServer($content) |
338 | 338 | { |
339 | - // phpcs:enable |
|
339 | + // phpcs:enable |
|
340 | 340 | $get = array(); |
341 | 341 | |
342 | 342 | $matches1 = array(); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | |
361 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
361 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
362 | 362 | /** |
363 | 363 | * Get openid server |
364 | 364 | * |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function GetOpenIDServer($url = '') |
369 | 369 | { |
370 | - // phpcs:enable |
|
370 | + // phpcs:enable |
|
371 | 371 | global $conf; |
372 | 372 | |
373 | 373 | include_once BASE_PATH . '/../Dolibarr/Lib/GetUrl.php'; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | return $servers[0]; |
393 | 393 | } |
394 | 394 | |
395 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
395 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
396 | 396 | /** |
397 | 397 | * GetRedirectURL |
398 | 398 | * |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function GetRedirectURL() |
402 | 402 | { |
403 | - // phpcs:enable |
|
403 | + // phpcs:enable |
|
404 | 404 | $params = array(); |
405 | 405 | $params['openid.return_to'] = urlencode($this->URLs['approved']); |
406 | 406 | $params['openid.mode'] = 'checkid_setup'; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | return $this->URLs['openid_server'] . "?" . $this->array2url($params); |
423 | 423 | } |
424 | 424 | |
425 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
425 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
426 | 426 | /** |
427 | 427 | * Redirect |
428 | 428 | * |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | */ |
431 | 431 | public function Redirect() |
432 | 432 | { |
433 | - // phpcs:enable |
|
433 | + // phpcs:enable |
|
434 | 434 | $redirect_to = $this->GetRedirectURL(); |
435 | 435 | if (headers_sent()) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe) |
436 | 436 | echo '<script nonce="' . getNonce() . '" type="text/javascript">window.location=\''; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
444 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
445 | 445 | /** |
446 | 446 | * ValidateWithServer |
447 | 447 | * |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function ValidateWithServer() |
451 | 451 | { |
452 | - // phpcs:enable |
|
452 | + // phpcs:enable |
|
453 | 453 | $params = array( |
454 | 454 | 'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']), |
455 | 455 | 'openid.signed' => urlencode($_GET['openid_signed']), |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | |
199 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
199 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
200 | 200 | /** |
201 | 201 | * Define array with couple substitution key => substitution value |
202 | 202 | * |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function get_substitutionarray_user($user, $outputlangs) |
208 | 208 | { |
209 | - // phpcs:enable |
|
209 | + // phpcs:enable |
|
210 | 210 | global $conf, $extrafields; |
211 | 211 | |
212 | 212 | $logotouse = $conf->user->dir_output . '/' . get_exdir(0, 0, 0, 0, $user, 'user') . 'photos/' . getImageFileNameForSize($user->photo, '_small'); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
295 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
296 | 296 | /** |
297 | 297 | * Define array with couple substitution key => substitution value |
298 | 298 | * |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function get_substitutionarray_mysoc($mysoc, $outputlangs) |
304 | 304 | { |
305 | - // phpcs:enable |
|
305 | + // phpcs:enable |
|
306 | 306 | global $conf; |
307 | 307 | |
308 | 308 | if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | } |
350 | 350 | |
351 | 351 | |
352 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
352 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
353 | 353 | /** |
354 | 354 | * Define array with couple substitution key => substitution value |
355 | 355 | * For example {company_name}, {company_name_alias} |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public function get_substitutionarray_thirdparty($object, $outputlangs, $array_key = 'company') |
363 | 363 | { |
364 | - // phpcs:enable |
|
364 | + // phpcs:enable |
|
365 | 365 | global $extrafields; |
366 | 366 | |
367 | 367 | if (empty($object->country) && !empty($object->country_code)) { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | return $array_thirdparty; |
416 | 416 | } |
417 | 417 | |
418 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
418 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
419 | 419 | /** |
420 | 420 | * Define array with couple substitution key => substitution value |
421 | 421 | * |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') |
428 | 428 | { |
429 | - // phpcs:enable |
|
429 | + // phpcs:enable |
|
430 | 430 | global $conf, $extrafields; |
431 | 431 | |
432 | 432 | if (empty($object->country) && !empty($object->country_code)) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | |
478 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
478 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
479 | 479 | /** |
480 | 480 | * Define array with couple substitution key => substitution value |
481 | 481 | * |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function get_substitutionarray_other($outputlangs) |
486 | 486 | { |
487 | - // phpcs:enable |
|
487 | + // phpcs:enable |
|
488 | 488 | global $conf; |
489 | 489 | |
490 | 490 | $now = dol_now('gmt'); // gmt |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | } |
516 | 516 | |
517 | 517 | |
518 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
518 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
519 | 519 | /** |
520 | 520 | * Define array with couple substitution key => substitution value |
521 | 521 | * Note that vars into substitutions array are formatted. |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') |
529 | 529 | { |
530 | - // phpcs:enable |
|
530 | + // phpcs:enable |
|
531 | 531 | global $extrafields; |
532 | 532 | |
533 | 533 | $sumpayed = $sumdeposit = $sumcreditnote = ''; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | return $resarray; |
718 | 718 | } |
719 | 719 | |
720 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
720 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
721 | 721 | /** |
722 | 722 | * Define array with couple substitution key => substitution value |
723 | 723 | * Note that vars into substitutions array are formatted. |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | */ |
730 | 730 | public function get_substitutionarray_lines($line, $outputlangs, $linenumber = 0) |
731 | 731 | { |
732 | - // phpcs:enable |
|
732 | + // phpcs:enable |
|
733 | 733 | $resarray = array( |
734 | 734 | 'line_pos' => $linenumber, |
735 | 735 | 'line_fulldesc' => doc_getlinedesc($line, $outputlangs), |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | return $resarray; |
841 | 841 | } |
842 | 842 | |
843 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
843 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
844 | 844 | /** |
845 | 845 | * Define array with couple substitution key => substitution value |
846 | 846 | * Note that vars into substitutions array are formatted. |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | */ |
853 | 853 | public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') |
854 | 854 | { |
855 | - // phpcs:enable |
|
855 | + // phpcs:enable |
|
856 | 856 | global $extrafields; |
857 | 857 | |
858 | 858 | include_once BASE_PATH . '/../Dolibarr/Lib/Product.php'; |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | } |
910 | 910 | |
911 | 911 | |
912 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
912 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
913 | 913 | /** |
914 | 914 | * Define array with couple substitution key => substitution value |
915 | 915 | * |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | */ |
921 | 921 | public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = 1) |
922 | 922 | { |
923 | - // phpcs:enable |
|
923 | + // phpcs:enable |
|
924 | 924 | $array_other = array(); |
925 | 925 | if (!empty($object)) { |
926 | 926 | foreach ($object as $key => $value) { |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | } |
950 | 950 | |
951 | 951 | |
952 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
952 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
953 | 953 | /** |
954 | 954 | * Fill array with couple extrafield key => extrafield value |
955 | 955 | * Note that vars into substitutions array are formatted. |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | */ |
964 | 964 | public function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs) |
965 | 965 | { |
966 | - // phpcs:enable |
|
966 | + // phpcs:enable |
|
967 | 967 | global $conf; |
968 | 968 | |
969 | 969 | if ($extrafields->attributes[$object->table_element]['count'] > 0) { |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * Message Sensitivity |
127 | 127 | */ |
128 | 128 | private $_arySensitivity = array(false, |
129 | - 'Personal', |
|
130 | - 'Private', |
|
131 | - 'Company Confidential'); |
|
129 | + 'Personal', |
|
130 | + 'Private', |
|
131 | + 'Company Confidential'); |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Message Sensitivity |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | * Content-Transfer-Encoding |
157 | 157 | */ |
158 | 158 | private $_smtpsTransEncodeTypes = array('7bit', // Simple 7-bit ASCII |
159 | - '8bit', // 8-bit coding with line termination characters |
|
160 | - 'base64', // 3 octets encoded into 4 sextets with offset |
|
161 | - 'binary', // Arbitrary binary stream |
|
162 | - 'mac-binhex40', // Macintosh binary to hex encoding |
|
163 | - 'quoted-printable', // Mostly 7-bit, with 8-bit characters encoded as "=HH" |
|
164 | - 'uuencode'); // UUENCODE encoding |
|
159 | + '8bit', // 8-bit coding with line termination characters |
|
160 | + 'base64', // 3 octets encoded into 4 sextets with offset |
|
161 | + 'binary', // Arbitrary binary stream |
|
162 | + 'mac-binhex40', // Macintosh binary to hex encoding |
|
163 | + 'quoted-printable', // Mostly 7-bit, with 8-bit characters encoded as "=HH" |
|
164 | + 'uuencode'); // UUENCODE encoding |
|
165 | 165 | |
166 | 166 | /** |
167 | 167 | * Content-Transfer-Encoding |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $_aryToList = $this->getTo(); |
387 | 387 | } |
388 | 388 | |
389 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
389 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
390 | 390 | /** |
391 | 391 | * Attempt a connection to mail server |
392 | 392 | * |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | private function _server_connect() |
396 | 396 | { |
397 | - // phpcs:enable |
|
397 | + // phpcs:enable |
|
398 | 398 | // Default return value |
399 | 399 | $_retVal = true; |
400 | 400 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | return $_retVal; |
465 | 465 | } |
466 | 466 | |
467 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
467 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
468 | 468 | /** |
469 | 469 | * Attempt mail server authentication for a secure connection |
470 | 470 | * |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | */ |
473 | 473 | private function _server_authenticate() |
474 | 474 | { |
475 | - // phpcs:enable |
|
475 | + // phpcs:enable |
|
476 | 476 | global $conf; |
477 | 477 | |
478 | 478 | require_once BASE_PATH . '/../Dolibarr/Lib/GetUrl.php'; |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $this->_msgRecipients = $aryHost; |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1202 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1203 | 1203 | /** |
1204 | 1204 | * Returns an array of the various parts of an email address |
1205 | 1205 | * This assumes a well formed address: |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | private function _strip_email($_strAddr) |
1220 | 1220 | { |
1221 | - // phpcs:enable |
|
1221 | + // phpcs:enable |
|
1222 | 1222 | $_aryEmail = array(); |
1223 | 1223 | // Keep the original |
1224 | 1224 | $_aryEmail['org'] = $_strAddr; |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | return $_aryEmail; |
1256 | 1256 | } |
1257 | 1257 | |
1258 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1258 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1259 | 1259 | /** |
1260 | 1260 | * Returns an array of bares addresses for use with 'RCPT TO:' |
1261 | 1261 | * This is a "build as you go" method. Each time this method is called |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | */ |
1266 | 1266 | public function get_RCPT_list() |
1267 | 1267 | { |
1268 | - // phpcs:enable |
|
1268 | + // phpcs:enable |
|
1269 | 1269 | /** |
1270 | 1270 | * An array of bares addresses for use with 'RCPT TO:' |
1271 | 1271 | */ |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | return $_RCPT_list; |
1285 | 1285 | } |
1286 | 1286 | |
1287 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1287 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1288 | 1288 | /** |
1289 | 1289 | * Returns an array of addresses for a specific type; TO, CC or BCC |
1290 | 1290 | * |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | */ |
1294 | 1294 | public function get_email_list($_which = null) |
1295 | 1295 | { |
1296 | - // phpcs:enable |
|
1296 | + // phpcs:enable |
|
1297 | 1297 | // We need to know which address segment to pull |
1298 | 1298 | if ($_which) { |
1299 | 1299 | // Make sure we have addresses to process |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | return ''; |
1901 | 1901 | } |
1902 | 1902 | |
1903 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1903 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1904 | 1904 | /** |
1905 | 1905 | * This function has been modified as provided by SirSir to allow multiline responses when |
1906 | 1906 | * using SMTP Extensions |
@@ -1913,7 +1913,7 @@ discard block |
||
1913 | 1913 | */ |
1914 | 1914 | public function server_parse($socket, $response) |
1915 | 1915 | { |
1916 | - // phpcs:enable |
|
1916 | + // phpcs:enable |
|
1917 | 1917 | /** |
1918 | 1918 | * Returns constructed SELECT Object string or boolean upon failure |
1919 | 1919 | * Default value is set at true |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | return $_retVal; |
1946 | 1946 | } |
1947 | 1947 | |
1948 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1948 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1949 | 1949 | /** |
1950 | 1950 | * Send str |
1951 | 1951 | * |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | */ |
1957 | 1957 | public function socket_send_str($_strSend, $_returnCode = null, $CRLF = "\r\n") |
1958 | 1958 | { |
1959 | - // phpcs:enable |
|
1959 | + // phpcs:enable |
|
1960 | 1960 | if ($this->_debug) { |
1961 | 1961 | $this->log .= $_strSend; // @CHANGE LDR for log |
1962 | 1962 | } |
@@ -1990,7 +1990,7 @@ discard block |
||
1990 | 1990 | return 1; |
1991 | 1991 | } |
1992 | 1992 | |
1993 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1993 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1994 | 1994 | /** |
1995 | 1995 | * Export bookkeeping |
1996 | 1996 | * |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | */ |
2000 | 2000 | public function export_bookkeeping($model = 'ebp') |
2001 | 2001 | { |
2002 | - // phpcs:enable |
|
2002 | + // phpcs:enable |
|
2003 | 2003 | global $conf; |
2004 | 2004 | |
2005 | 2005 | $sql = "SELECT rowid, doc_date, doc_type,"; |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | */ |
2183 | 2183 | } |
2184 | 2184 | |
2185 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2185 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2186 | 2186 | /** |
2187 | 2187 | * Return list of accounts with label by chart of accounts |
2188 | 2188 | * |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | */ |
2198 | 2198 | public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') |
2199 | 2199 | { |
2200 | - // phpcs:enable |
|
2200 | + // phpcs:enable |
|
2201 | 2201 | global $conf; |
2202 | 2202 | |
2203 | 2203 | require_once BASE_PATH . '/../Dolibarr/Lib/Accounting.php'; |
@@ -2294,7 +2294,7 @@ discard block |
||
2294 | 2294 | } |
2295 | 2295 | } |
2296 | 2296 | |
2297 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2297 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2298 | 2298 | /** |
2299 | 2299 | * Description of accounting account |
2300 | 2300 | * |
@@ -2303,7 +2303,7 @@ discard block |
||
2303 | 2303 | */ |
2304 | 2304 | public function get_compte_desc($account = null) |
2305 | 2305 | { |
2306 | - // phpcs:enable |
|
2306 | + // phpcs:enable |
|
2307 | 2307 | global $conf; |
2308 | 2308 | |
2309 | 2309 | $pcgver = getDolGlobalInt('CHARTOFACCOUNTS'); |
@@ -118,13 +118,13 @@ |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | - * Return array head with list of tabs to view object information |
|
122 | - * |
|
123 | - * @param BonPrelevement $object Member |
|
124 | - * @param int $nbOfInvoices No of invoices |
|
125 | - * @param int $nbOfSalaryInvoice No of salary invoices |
|
126 | - * @return array head |
|
127 | - */ |
|
121 | + * Return array head with list of tabs to view object information |
|
122 | + * |
|
123 | + * @param BonPrelevement $object Member |
|
124 | + * @param int $nbOfInvoices No of invoices |
|
125 | + * @param int $nbOfSalaryInvoice No of salary invoices |
|
126 | + * @return array head |
|
127 | + */ |
|
128 | 128 | function bon_prelevement_prepare_head(BonPrelevement $object, $nbOfInvoices, $nbOfSalaryInvoice) |
129 | 129 | { |
130 | 130 | global $langs, $conf; |
@@ -1387,7 +1387,7 @@ |
||
1387 | 1387 | |
1388 | 1388 | // build format asciidoc for urls in table |
1389 | 1389 | if (!$error) { |
1390 | - $asciiDocTable = "[options=\"header\"]\n|===\n|Object | URLs\n"; // phpcs:ignore |
|
1390 | + $asciiDocTable = "[options=\"header\"]\n|===\n|Object | URLs\n"; // phpcs:ignore |
|
1391 | 1391 | foreach ($groupedUrls as $objectName => $urls) { |
1392 | 1392 | $urlsList = implode(" +\n*", $urls); |
1393 | 1393 | $asciiDocTable .= "|$objectName | \n*$urlsList +\n"; |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | |
69 | 69 | // Check if company name is defined (first install) |
70 | 70 | if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || !getDolGlobalString('MAIN_INFO_SOCIETE_NOM')) { |
71 | - header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete"); |
|
72 | - exit; |
|
71 | + header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete"); |
|
72 | + exit; |
|
73 | 73 | } |
74 | 74 | if ($nbmodulesnotautoenabled <= getDolGlobalString('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only user module enabled |
75 | - header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete"); |
|
76 | - exit; |
|
75 | + header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete"); |
|
76 | + exit; |
|
77 | 77 | } |
78 | 78 | if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled) |
79 | - require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; |
|
80 | - $zone = GETPOSTINT('areacode'); |
|
81 | - $userid = GETPOSTINT('userid'); |
|
82 | - $boxorder = GETPOST('boxorder', 'aZ09'); |
|
83 | - $boxorder .= GETPOST('boxcombo', 'aZ09'); |
|
84 | - |
|
85 | - $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid); |
|
86 | - if ($result > 0) { |
|
87 | - setEventMessages($langs->trans("BoxAdded"), null); |
|
88 | - } |
|
79 | + require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; |
|
80 | + $zone = GETPOSTINT('areacode'); |
|
81 | + $userid = GETPOSTINT('userid'); |
|
82 | + $boxorder = GETPOST('boxorder', 'aZ09'); |
|
83 | + $boxorder .= GETPOST('boxcombo', 'aZ09'); |
|
84 | + |
|
85 | + $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid); |
|
86 | + if ($result > 0) { |
|
87 | + setEventMessages($langs->trans("BoxAdded"), null); |
|
88 | + } |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /* |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | */ |
94 | 94 | |
95 | 95 | if (!isset($form) || !is_object($form)) { |
96 | - $form = new Form($db); |
|
96 | + $form = new Form($db); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // Title |
100 | 100 | $title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION; |
101 | 101 | if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { |
102 | - $title = $langs->trans("HomeArea") . ' - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
102 | + $title = $langs->trans("HomeArea") . ' - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | llxHeader('', $title); |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | print load_fiche_titre(' ', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome'); |
110 | 110 | |
111 | 111 | if (getDolGlobalString('MAIN_MOTD')) { |
112 | - $conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD')); |
|
113 | - if (getDolGlobalString('MAIN_MOTD')) { |
|
114 | - $substitutionarray = getCommonSubstitutionArray($langs); |
|
115 | - complete_substitutions_array($substitutionarray, $langs); |
|
116 | - $texttoshow = make_substitutions(getDolGlobalString('MAIN_MOTD'), $substitutionarray, $langs); |
|
117 | - |
|
118 | - print "\n<!-- Start of welcome text -->\n"; |
|
119 | - print '<table class="centpercent notopnoleftnoright"><tr><td>'; |
|
120 | - print dol_htmlentitiesbr($texttoshow); |
|
121 | - print '</td></tr></table><br>'; |
|
122 | - print "\n<!-- End of welcome text -->\n"; |
|
123 | - } |
|
112 | + $conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD')); |
|
113 | + if (getDolGlobalString('MAIN_MOTD')) { |
|
114 | + $substitutionarray = getCommonSubstitutionArray($langs); |
|
115 | + complete_substitutions_array($substitutionarray, $langs); |
|
116 | + $texttoshow = make_substitutions(getDolGlobalString('MAIN_MOTD'), $substitutionarray, $langs); |
|
117 | + |
|
118 | + print "\n<!-- Start of welcome text -->\n"; |
|
119 | + print '<table class="centpercent notopnoleftnoright"><tr><td>'; |
|
120 | + print dol_htmlentitiesbr($texttoshow); |
|
121 | + print '</td></tr></table><br>'; |
|
122 | + print "\n<!-- End of welcome text -->\n"; |
|
123 | + } |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /* |
@@ -129,35 +129,35 @@ discard block |
||
129 | 129 | |
130 | 130 | // Security warning if install.lock file is missing or if conf file is writable |
131 | 131 | if (!getDolGlobalString('MAIN_REMOVE_INSTALL_WARNING')) { |
132 | - $message = ''; |
|
133 | - |
|
134 | - // Check if install lock file is present |
|
135 | - $lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
136 | - if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) { |
|
137 | - $langs->load("errors"); |
|
138 | - //if (!empty($message)) $message.='<br>'; |
|
139 | - $message .= info_admin($langs->transnoentities("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
140 | - } |
|
141 | - |
|
142 | - // Conf files must be in read only mode |
|
143 | - if (is_writable($conffile)) { // $conffile is defined into filefunc.inc.php |
|
144 | - $langs->load("errors"); |
|
145 | - //$langs->load("other"); |
|
146 | - //if (!empty($message)) $message.='<br>'; |
|
147 | - $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
148 | - } |
|
149 | - |
|
150 | - $object = new stdClass(); |
|
151 | - $parameters = array(); |
|
152 | - $reshook = $hookmanager->executeHooks('infoadmin', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
153 | - if ($reshook == 0) { |
|
154 | - $message .= $hookmanager->resPrint; |
|
155 | - } |
|
156 | - if ($message) { // $message is an HTML string. |
|
157 | - print dol_string_onlythesehtmltags($message, 1, 0, 0, 0, array('div', 'span', 'b')); |
|
158 | - print '<br>'; |
|
159 | - //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); |
|
160 | - } |
|
132 | + $message = ''; |
|
133 | + |
|
134 | + // Check if install lock file is present |
|
135 | + $lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
136 | + if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) { |
|
137 | + $langs->load("errors"); |
|
138 | + //if (!empty($message)) $message.='<br>'; |
|
139 | + $message .= info_admin($langs->transnoentities("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
140 | + } |
|
141 | + |
|
142 | + // Conf files must be in read only mode |
|
143 | + if (is_writable($conffile)) { // $conffile is defined into filefunc.inc.php |
|
144 | + $langs->load("errors"); |
|
145 | + //$langs->load("other"); |
|
146 | + //if (!empty($message)) $message.='<br>'; |
|
147 | + $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
148 | + } |
|
149 | + |
|
150 | + $object = new stdClass(); |
|
151 | + $parameters = array(); |
|
152 | + $reshook = $hookmanager->executeHooks('infoadmin', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
153 | + if ($reshook == 0) { |
|
154 | + $message .= $hookmanager->resPrint; |
|
155 | + } |
|
156 | + if ($message) { // $message is an HTML string. |
|
157 | + print dol_string_onlythesehtmltags($message, 1, 0, 0, 0, array('div', 'span', 'b')); |
|
158 | + print '<br>'; |
|
159 | + //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); |
|
160 | + } |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /* |
@@ -173,577 +173,577 @@ discard block |
||
173 | 173 | |
174 | 174 | // Dolibarr Working Board with weather |
175 | 175 | if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
176 | - $showweather = (!getDolGlobalString('MAIN_DISABLE_METEO') || getDolGlobalInt('MAIN_DISABLE_METEO') == 2) ? 1 : 0; |
|
177 | - |
|
178 | - //Array that contains all WorkboardResponse classes to process them |
|
179 | - $dashboardlines = array(); |
|
180 | - |
|
181 | - // Number of actions to do (late) |
|
182 | - if (isModEnabled('agenda') && !getDolGlobalString('MAIN_DISABLE_BLOCK_AGENDA') && $user->hasRight('agenda', 'myactions', 'read')) { |
|
183 | - $board = new ActionComm($db); |
|
184 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
185 | - } |
|
186 | - |
|
187 | - // Number of project opened |
|
188 | - if (isModEnabled('project') && !getDolGlobalString('MAIN_DISABLE_BLOCK_PROJECT') && $user->hasRight('projet', 'lire')) { |
|
189 | - $board = new Project($db); |
|
190 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
191 | - } |
|
192 | - |
|
193 | - // Number of tasks to do (late) |
|
194 | - if (isModEnabled('project') && !getDolGlobalString('MAIN_DISABLE_BLOCK_PROJECT') && !getDolGlobalString('PROJECT_HIDE_TASKS') && $user->hasRight('projet', 'lire')) { |
|
195 | - $board = new Task($db); |
|
196 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
197 | - } |
|
198 | - |
|
199 | - // Number of commercial customer proposals open (expired) |
|
200 | - if (isModEnabled('propal') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('propal', 'read')) { |
|
201 | - $board = new Propal($db); |
|
202 | - $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
203 | - // Number of commercial proposals CLOSED signed (billed) |
|
204 | - $dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed"); |
|
205 | - } |
|
206 | - |
|
207 | - // Number of supplier proposals open (expired) |
|
208 | - if (isModEnabled('supplier_proposal') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('supplier_proposal', 'lire')) { |
|
209 | - $langs->load("supplier_proposal"); |
|
210 | - $board = new SupplierProposal($db); |
|
211 | - $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
212 | - // Number of commercial proposals CLOSED signed (billed) |
|
213 | - $dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed"); |
|
214 | - } |
|
215 | - |
|
216 | - // Number of sales orders |
|
217 | - if (isModEnabled('order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('commande', 'lire')) { |
|
218 | - $board = new Commande($db); |
|
219 | - // Number of customer orders to be shipped (validated and in progress) |
|
220 | - $dashboardlines[$board->element . '_toship'] = $board->load_board($user, 'toship'); |
|
221 | - // Number of customer orders to be billed (not visible by default, does not match a lot of organization). |
|
222 | - if (getDolGlobalInt('ORDER_BILL_AFTER_VALIDATION')) { |
|
223 | - $dashboardlines[$board->element . '_tobill'] = $board->load_board($user, 'tobill'); |
|
224 | - } |
|
225 | - // Number of customer orders to be billed (delivered but not billed) |
|
226 | - $dashboardlines[$board->element . '_shippedtobill'] = $board->load_board($user, 'shippedtobill'); |
|
227 | - } |
|
228 | - |
|
229 | - // Number of suppliers orders |
|
230 | - if (isModEnabled('supplier_order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('fournisseur', 'commande', 'lire')) { |
|
231 | - $board = new CommandeFournisseur($db); |
|
232 | - $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
233 | - $dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting'); |
|
234 | - } |
|
235 | - |
|
236 | - // Number of contract / services enabled (delayed) |
|
237 | - if (isModEnabled('contract') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CONTRACT') && $user->hasRight('contrat', 'lire')) { |
|
238 | - $board = new Contrat($db); |
|
239 | - $dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive"); |
|
240 | - // Number of active services (expired) |
|
241 | - $dashboardlines[$board->element . '_active'] = $board->load_board($user, "active"); |
|
242 | - } |
|
243 | - |
|
244 | - // Number of tickets open |
|
245 | - if (isModEnabled('ticket') && !getDolGlobalString('MAIN_DISABLE_BLOCK_TICKET') && $user->hasRight('ticket', 'read')) { |
|
246 | - $board = new Ticket($db); |
|
247 | - $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
248 | - // Number of active services (expired) |
|
249 | - //$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active"); |
|
250 | - } |
|
251 | - |
|
252 | - // Number of invoices customers (paid) |
|
253 | - if (isModEnabled('invoice') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('facture', 'lire')) { |
|
254 | - $board = new Facture($db); |
|
255 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
256 | - } |
|
257 | - |
|
258 | - // Number of supplier invoices (paid) |
|
259 | - if (isModEnabled('supplier_invoice') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('fournisseur', 'facture', 'lire')) { |
|
260 | - $board = new FactureFournisseur($db); |
|
261 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
262 | - } |
|
263 | - |
|
264 | - // Number of transactions to conciliate |
|
265 | - if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
266 | - $board = new Account($db); |
|
267 | - $nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate |
|
268 | - if ($nb > 0) { |
|
269 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
270 | - } |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - // Number of cheque to send |
|
275 | - if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
276 | - if (!getDolGlobalString('BANK_DISABLE_CHECK_DEPOSIT')) { |
|
277 | - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; |
|
278 | - $board = new RemiseCheque($db); |
|
279 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
280 | - } |
|
281 | - if (isModEnabled('prelevement')) { |
|
282 | - include_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php'; |
|
283 | - $board = new BonPrelevement($db); |
|
284 | - $dashboardlines[$board->element . '_direct_debit'] = $board->load_board($user, 'direct_debit'); |
|
285 | - } |
|
286 | - if (isModEnabled('paymentbybanktransfer')) { |
|
287 | - include_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php'; |
|
288 | - $board = new BonPrelevement($db); |
|
289 | - $dashboardlines[$board->element . '_credit_transfer'] = $board->load_board($user, 'credit_transfer'); |
|
290 | - } |
|
291 | - } |
|
292 | - |
|
293 | - // Number of foundation members |
|
294 | - if (isModEnabled('member') && !getDolGlobalString('MAIN_DISABLE_BLOCK_ADHERENT') && $user->hasRight('adherent', 'lire') && !$user->socid) { |
|
295 | - $board = new Adherent($db); |
|
296 | - $dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift'); |
|
297 | - $dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired'); |
|
298 | - } |
|
299 | - |
|
300 | - // Number of expense reports to approve |
|
301 | - if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'approve')) { |
|
302 | - $board = new ExpenseReport($db); |
|
303 | - $dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove'); |
|
304 | - } |
|
305 | - |
|
306 | - // Number of expense reports to pay |
|
307 | - if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'to_paid')) { |
|
308 | - $board = new ExpenseReport($db); |
|
309 | - $dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay'); |
|
310 | - } |
|
311 | - |
|
312 | - // Number of holidays to approve |
|
313 | - if (isModEnabled('holiday') && !getDolGlobalString('MAIN_DISABLE_BLOCK_HOLIDAY') && $user->hasRight('holiday', 'approve')) { |
|
314 | - $board = new Holiday($db); |
|
315 | - $dashboardlines[$board->element] = $board->load_board($user); |
|
316 | - } |
|
317 | - |
|
318 | - $object = new stdClass(); |
|
319 | - $parameters = array(); |
|
320 | - $action = ''; |
|
321 | - $reshook = $hookmanager->executeHooks( |
|
322 | - 'addOpenElementsDashboardLine', |
|
323 | - $parameters, |
|
324 | - $object, |
|
325 | - $action |
|
326 | - ); // Note that $action and $object may have been modified by some hooks |
|
327 | - if ($reshook == 0) { |
|
328 | - $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); |
|
329 | - } |
|
330 | - |
|
331 | - /* Open object dashboard */ |
|
332 | - $dashboardgroup = array( |
|
333 | - 'action' => |
|
334 | - array( |
|
335 | - 'groupName' => 'Agenda', |
|
336 | - 'stats' => array('action'), |
|
337 | - ), |
|
338 | - 'project' => |
|
339 | - array( |
|
340 | - 'groupName' => 'Projects', |
|
341 | - 'globalStatsKey' => 'projects', |
|
342 | - 'stats' => array('project', 'project_task'), |
|
343 | - ), |
|
344 | - 'propal' => |
|
345 | - array( |
|
346 | - 'groupName' => 'Proposals', |
|
347 | - 'globalStatsKey' => 'proposals', |
|
348 | - 'stats' => |
|
349 | - array('propal_opened', 'propal_signed'), |
|
350 | - ), |
|
351 | - 'commande' => |
|
352 | - array( |
|
353 | - 'groupName' => 'Orders', |
|
354 | - 'globalStatsKey' => 'orders', |
|
355 | - 'stats' => |
|
356 | - array('commande_toship', 'commande_tobill', 'commande_shippedtobill'), |
|
357 | - ), |
|
358 | - 'facture' => |
|
359 | - array( |
|
360 | - 'groupName' => 'Invoices', |
|
361 | - 'globalStatsKey' => 'invoices', |
|
362 | - 'stats' => |
|
363 | - array('facture'), |
|
364 | - ), |
|
365 | - 'supplier_proposal' => |
|
366 | - array( |
|
367 | - 'lang' => 'supplier_proposal', |
|
368 | - 'groupName' => 'SupplierProposals', |
|
369 | - 'globalStatsKey' => 'askprice', |
|
370 | - 'stats' => |
|
371 | - array('supplier_proposal_opened', 'supplier_proposal_signed'), |
|
372 | - ), |
|
373 | - 'order_supplier' => |
|
374 | - array( |
|
375 | - 'groupName' => 'SuppliersOrders', |
|
376 | - 'globalStatsKey' => 'supplier_orders', |
|
377 | - 'stats' => |
|
378 | - array('order_supplier_opened', 'order_supplier_awaiting'), |
|
379 | - ), |
|
380 | - 'invoice_supplier' => |
|
381 | - array( |
|
382 | - 'groupName' => 'BillsSuppliers', |
|
383 | - 'globalStatsKey' => 'supplier_invoices', |
|
384 | - 'stats' => |
|
385 | - array('invoice_supplier'), |
|
386 | - ), |
|
387 | - 'contrat' => |
|
388 | - array( |
|
389 | - 'groupName' => 'Contracts', |
|
390 | - 'globalStatsKey' => 'Contracts', |
|
391 | - 'stats' => |
|
392 | - array('contrat_inactive', 'contrat_active'), |
|
393 | - ), |
|
394 | - 'ticket' => |
|
395 | - array( |
|
396 | - 'groupName' => 'Tickets', |
|
397 | - 'globalStatsKey' => 'ticket', |
|
398 | - 'stats' => |
|
399 | - array('ticket_opened'), |
|
400 | - ), |
|
401 | - 'bank_account' => |
|
402 | - array( |
|
403 | - 'groupName' => 'BankAccount', |
|
404 | - 'stats' => |
|
405 | - array('bank_account', 'chequereceipt', 'widthdraw_direct_debit', 'widthdraw_credit_transfer'), |
|
406 | - ), |
|
407 | - 'member' => |
|
408 | - array( |
|
409 | - 'groupName' => 'Members', |
|
410 | - 'globalStatsKey' => 'members', |
|
411 | - 'stats' => |
|
412 | - array('member_shift', 'member_expired'), |
|
413 | - ), |
|
414 | - 'expensereport' => |
|
415 | - array( |
|
416 | - 'groupName' => 'ExpenseReport', |
|
417 | - 'globalStatsKey' => 'expensereports', |
|
418 | - 'stats' => |
|
419 | - array('expensereport_toapprove', 'expensereport_topay'), |
|
420 | - ), |
|
421 | - 'holiday' => |
|
422 | - array( |
|
423 | - 'groupName' => 'Holidays', |
|
424 | - 'globalStatsKey' => 'holidays', |
|
425 | - 'stats' => |
|
426 | - array('holiday'), |
|
427 | - ), |
|
428 | - ); |
|
429 | - |
|
430 | - $object = new stdClass(); |
|
431 | - $parameters = array( |
|
432 | - 'dashboardgroup' => $dashboardgroup |
|
433 | - ); |
|
434 | - $reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
435 | - if ($reshook == 0) { |
|
436 | - $dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray); |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - // Calculate total nb of late |
|
441 | - $totallate = $totaltodo = 0; |
|
442 | - |
|
443 | - //Remove any invalid response |
|
444 | - //load_board can return an integer if failed, or WorkboardResponse if OK |
|
445 | - $valid_dashboardlines = array(); |
|
446 | - foreach ($dashboardlines as $workboardid => $tmp) { |
|
447 | - if ($tmp instanceof WorkboardResponse) { |
|
448 | - $tmp->id = $workboardid; // Complete the object to add its id into its name |
|
449 | - $valid_dashboardlines[$workboardid] = $tmp; |
|
450 | - } |
|
451 | - } |
|
452 | - |
|
453 | - // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop |
|
454 | - foreach ($valid_dashboardlines as $board) { |
|
455 | - if (is_numeric($board->nbtodo) && is_numeric($board->nbtodolate) && $board->nbtodolate > 0) { |
|
456 | - $totaltodo += $board->nbtodo; |
|
457 | - $totallate += $board->nbtodolate; |
|
458 | - } |
|
459 | - } |
|
460 | - |
|
461 | - $openedDashBoardSize = 'info-box-sm'; // use sm by default |
|
462 | - foreach ($dashboardgroup as $dashbordelement) { |
|
463 | - if (is_array($dashbordelement['stats']) && count($dashbordelement['stats']) > 2) { |
|
464 | - $openedDashBoardSize = ''; // use default info box size : big |
|
465 | - break; |
|
466 | - } |
|
467 | - } |
|
468 | - |
|
469 | - $totalLateNumber = $totallate; |
|
470 | - $totallatePercentage = ((!empty($totaltodo)) ? round($totallate / $totaltodo * 100, 2) : 0); |
|
471 | - if (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE')) { |
|
472 | - $totallate = $totallatePercentage; |
|
473 | - } |
|
474 | - |
|
475 | - $boxwork = ''; |
|
476 | - $boxwork .= '<div class="box">'; |
|
477 | - $boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">' . "\n"; |
|
478 | - $boxwork .= '<tr class="liste_titre">'; |
|
479 | - $boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">' . $langs->trans("DolibarrWorkBoard") . '</div>'; |
|
480 | - if ($showweather) { |
|
481 | - if ($totallate > 0) { |
|
482 | - $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv( |
|
483 | - "NActionsLate", |
|
484 | - $totallate . (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE') ? '%' : '') |
|
485 | - ) . ')'; |
|
486 | - } else { |
|
487 | - $text = $langs->transnoentitiesnoconv("NoItemLate"); |
|
488 | - } |
|
489 | - $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); |
|
490 | - //$text.=$form->textwithpicto('',$langs->trans("LateDesc")); |
|
491 | - $options = 'height="24px" style="float: right"'; |
|
492 | - $boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle'); |
|
493 | - } |
|
494 | - $boxwork .= '</th>'; |
|
495 | - $boxwork .= '</tr>' . "\n"; |
|
496 | - |
|
497 | - // Show dashboard |
|
498 | - $nbworkboardempty = 0; |
|
499 | - $isIntopOpenedDashBoard = $globalStatInTopOpenedDashBoard = array(); |
|
500 | - if (!empty($valid_dashboardlines)) { |
|
501 | - $openedDashBoard = ''; |
|
502 | - |
|
503 | - $boxwork .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">'; |
|
504 | - |
|
505 | - foreach ($dashboardgroup as $groupKey => $groupElement) { |
|
506 | - $boards = array(); |
|
507 | - |
|
508 | - // Scan $groupElement and save the one with 'stats' that must be used for the open objects dashboard |
|
509 | - if (!getDolGlobalString('MAIN_DISABLE_NEW_OPENED_DASH_BOARD')) { |
|
510 | - foreach ($groupElement['stats'] as $infoKey) { |
|
511 | - if (!empty($valid_dashboardlines[$infoKey])) { |
|
512 | - $boards[] = $valid_dashboardlines[$infoKey]; |
|
513 | - $isIntopOpenedDashBoard[] = $infoKey; |
|
514 | - } |
|
515 | - } |
|
516 | - } |
|
517 | - |
|
518 | - if (!empty($boards)) { |
|
519 | - if (!empty($groupElement['lang'])) { |
|
520 | - $langs->load($groupElement['lang']); |
|
521 | - } |
|
522 | - $groupName = $langs->trans($groupElement['groupName']); |
|
523 | - $groupKeyLowerCase = strtolower($groupKey); |
|
524 | - |
|
525 | - // global stats |
|
526 | - $globalStatsKey = false; |
|
527 | - if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])) { // can be filled by hook |
|
528 | - $globalStatsKey = $groupElement['globalStatsKey']; |
|
529 | - $groupElement['globalStats'] = array(); |
|
530 | - } |
|
531 | - |
|
532 | - $openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">' . "\n"; |
|
533 | - $openedDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . '">' . "\n"; |
|
534 | - $openedDashBoard .= ' <span class="info-box-icon bg-infobox-' . $groupKeyLowerCase . '">' . "\n"; |
|
535 | - $openedDashBoard .= ' <i class="fa fa-dol-' . $groupKeyLowerCase . '"></i>' . "\n"; |
|
536 | - |
|
537 | - // Show the span for the total of record. TODO This seems not used. |
|
538 | - if (!empty($groupElement['globalStats'])) { |
|
539 | - $globalStatInTopOpenedDashBoard[] = $globalStatsKey; |
|
540 | - $openedDashBoard .= '<span class="info-box-icon-text" title="' . $groupElement['globalStats']['text'] . '">' . $groupElement['globalStats']['nbTotal'] . '</span>'; |
|
541 | - } |
|
542 | - |
|
543 | - $openedDashBoard .= '</span>' . "\n"; |
|
544 | - $openedDashBoard .= '<div class="info-box-content">' . "\n"; |
|
545 | - |
|
546 | - $openedDashBoard .= '<div class="info-box-title" title="' . strip_tags($groupName) . '">' . $groupName . '</div>' . "\n"; |
|
547 | - $openedDashBoard .= '<div class="info-box-lines">' . "\n"; |
|
548 | - |
|
549 | - foreach ($boards as $board) { |
|
550 | - $openedDashBoard .= '<div class="info-box-line spanoverflow nowrap">'; |
|
551 | - |
|
552 | - if (!empty($board->labelShort)) { |
|
553 | - $infoName = '<div class="marginrightonly inline-block valignmiddle info-box-line-text" title="' . $board->label . '">' . $board->labelShort . '</div>'; |
|
554 | - } else { |
|
555 | - $infoName = '<div class="marginrightonly inline-block valignmiddle info-box-line-text">' . $board->label . '</div>'; |
|
556 | - } |
|
557 | - |
|
558 | - $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate); |
|
559 | - $textLateTitle .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil(empty($board->warning_delay) ? 0 : $board->warning_delay) >= 0 ? '+' : '') . ceil(empty($board->warning_delay) ? 0 : $board->warning_delay) . ' ' . $langs->trans("days") . ')'; |
|
560 | - |
|
561 | - if ($board->id == 'bank_account') { |
|
562 | - $textLateTitle .= '<br><span class="opacitymedium">' . $langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")) . '</span>'; |
|
563 | - } |
|
564 | - |
|
565 | - $textLate = ''; |
|
566 | - if ($board->nbtodolate > 0) { |
|
567 | - $textLate .= '<span title="' . dol_escape_htmltag($textLateTitle) . '" class="classfortooltip badge badge-warning">'; |
|
568 | - $textLate .= '<i class="fa fa-exclamation-triangle"></i> ' . $board->nbtodolate; |
|
569 | - $textLate .= '</span>'; |
|
570 | - } |
|
571 | - |
|
572 | - $nbtodClass = ''; |
|
573 | - if ($board->nbtodo > 0) { |
|
574 | - $nbtodClass = 'badge badge-info'; |
|
575 | - } else { |
|
576 | - $nbtodClass = 'opacitymedium'; |
|
577 | - } |
|
578 | - |
|
579 | - // Forge the line to show into the open object box |
|
580 | - $labeltoshow = $board->label . ' (' . $board->nbtodo . ')'; |
|
581 | - if ($board->total > 0) { |
|
582 | - $labeltoshow .= ' - ' . price($board->total, 0, $langs, 1, -1, -1, $conf->currency); |
|
583 | - } |
|
584 | - $openedDashBoard .= '<a href="' . $board->url . '" class="info-box-text info-box-text-a">'; |
|
585 | - $openedDashBoard .= $infoName; |
|
586 | - $openedDashBoard .= '<div class="inline-block nowraponall">'; |
|
587 | - $openedDashBoard .= '<span class="classfortooltip' . ($nbtodClass ? ' ' . $nbtodClass : '') . '" title="' . $labeltoshow . '">'; |
|
588 | - $openedDashBoard .= $board->nbtodo; |
|
589 | - if ($board->total > 0 && getDolGlobalString('MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX')) { |
|
590 | - $openedDashBoard .= ' : ' . price($board->total, 0, $langs, 1, -1, -1, $conf->currency); |
|
591 | - } |
|
592 | - $openedDashBoard .= '</span>'; |
|
593 | - |
|
594 | - if ($textLate) { |
|
595 | - if ($board->url_late) { |
|
596 | - $openedDashBoard .= '</div></a>'; |
|
597 | - $openedDashBoard .= ' <div class="inline-block"><a href="' . $board->url_late . '" class="info-box-text info-box-text-a paddingleft">'; |
|
598 | - } else { |
|
599 | - $openedDashBoard .= ' '; |
|
600 | - } |
|
601 | - $openedDashBoard .= $textLate; |
|
602 | - } |
|
603 | - $openedDashBoard .= '</a>' . "\n"; |
|
604 | - $openedDashBoard .= '</div>'; |
|
605 | - $openedDashBoard .= '</div>' . "\n"; |
|
606 | - } |
|
607 | - |
|
608 | - // TODO Add hook here to add more "info-box-line" |
|
609 | - |
|
610 | - $openedDashBoard .= ' </div><!-- /.info-box-lines --></div><!-- /.info-box-content -->' . "\n"; |
|
611 | - $openedDashBoard .= ' </div><!-- /.info-box -->' . "\n"; |
|
612 | - $openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->' . "\n"; |
|
613 | - $openedDashBoard .= '</div><!-- /.box-flex-item -->' . "\n"; |
|
614 | - $openedDashBoard .= "\n"; |
|
615 | - } |
|
616 | - } |
|
617 | - |
|
618 | - if ($showweather && !empty($isIntopOpenedDashBoard)) { |
|
619 | - $appendClass = (getDolGlobalInt('MAIN_DISABLE_METEO') == 2 ? ' hideonsmartphone' : ''); |
|
620 | - $weather = getWeatherStatus($totallate); |
|
621 | - |
|
622 | - $text = ''; |
|
623 | - if ($totallate > 0) { |
|
624 | - $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv( |
|
625 | - "NActionsLate", |
|
626 | - $totallate . (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE') ? '%' : '') |
|
627 | - ) . ')'; |
|
628 | - } else { |
|
629 | - $text = $langs->transnoentitiesnoconv("NoItemLate"); |
|
630 | - } |
|
631 | - $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); |
|
632 | - |
|
633 | - $weatherDashBoard = '<div class="box-flex-item ' . $appendClass . '"><div class="box-flex-item-with-margin">' . "\n"; |
|
634 | - $weatherDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . ' info-box-weather info-box-weather-level' . $weather->level . '">' . "\n"; |
|
635 | - $weatherDashBoard .= ' <span class="info-box-icon">'; |
|
636 | - $weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50'); |
|
637 | - $weatherDashBoard .= ' </span>' . "\n"; |
|
638 | - $weatherDashBoard .= ' <div class="info-box-content">' . "\n"; |
|
639 | - $weatherDashBoard .= ' <div class="info-box-title">' . $langs->trans('GlobalOpenedElemView') . '</div>' . "\n"; |
|
640 | - |
|
641 | - if ($totallatePercentage > 0 && getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE')) { |
|
642 | - $weatherDashBoard .= ' <span class="info-box-number">' . $langs->transnoentitiesnoconv( |
|
643 | - "NActionsLate", |
|
644 | - price($totallatePercentage) . '%' |
|
645 | - ) . '</span>' . "\n"; |
|
646 | - $weatherDashBoard .= ' <span class="progress-description">' . $langs->trans( |
|
647 | - 'NActionsLate', |
|
648 | - $totalLateNumber |
|
649 | - ) . '</span>' . "\n"; |
|
650 | - } else { |
|
651 | - $weatherDashBoard .= ' <span class="info-box-number">' . $langs->transnoentitiesnoconv( |
|
652 | - "NActionsLate", |
|
653 | - $totalLateNumber |
|
654 | - ) . '</span>' . "\n"; |
|
655 | - if ($totallatePercentage > 0) { |
|
656 | - $weatherDashBoard .= ' <span class="progress-description">' . $langs->trans( |
|
657 | - 'NActionsLate', |
|
658 | - price($totallatePercentage) . '%' |
|
659 | - ) . '</span>' . "\n"; |
|
660 | - } |
|
661 | - } |
|
662 | - |
|
663 | - $weatherDashBoard .= ' </div><!-- /.info-box-content -->' . "\n"; |
|
664 | - $weatherDashBoard .= ' </div><!-- /.info-box -->' . "\n"; |
|
665 | - $weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->' . "\n"; |
|
666 | - $weatherDashBoard .= '</div><!-- /.box-flex-item -->' . "\n"; |
|
667 | - $weatherDashBoard .= "\n"; |
|
668 | - |
|
669 | - $openedDashBoard = $weatherDashBoard . $openedDashBoard; |
|
670 | - } |
|
671 | - |
|
672 | - if (!empty($isIntopOpenedDashBoard)) { |
|
673 | - for ($i = 1; $i <= 10; $i++) { |
|
674 | - $openedDashBoard .= '<div class="box-flex-item filler"></div>'; |
|
675 | - } |
|
676 | - } |
|
677 | - |
|
678 | - $nbworkboardcount = 0; |
|
679 | - foreach ($valid_dashboardlines as $infoKey => $board) { |
|
680 | - if (in_array($infoKey, $isIntopOpenedDashBoard)) { |
|
681 | - // skip if info is present on top |
|
682 | - continue; |
|
683 | - } |
|
684 | - |
|
685 | - if (empty($board->nbtodo)) { |
|
686 | - $nbworkboardempty++; |
|
687 | - } |
|
688 | - $nbworkboardcount++; |
|
689 | - |
|
690 | - |
|
691 | - $textlate = $langs->trans("NActionsLate", $board->nbtodolate); |
|
692 | - $textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')'; |
|
693 | - |
|
694 | - |
|
695 | - $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">'; |
|
696 | - $boxwork .= '<div class="boxstatscontent">'; |
|
697 | - $boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' <span>' . $board->label . '</span></span><br>'; |
|
698 | - $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>'; |
|
699 | - if ($board->total > 0 && getDolGlobalString('MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX')) { |
|
700 | - $boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>'; |
|
701 | - } |
|
702 | - $boxwork .= '</div>'; |
|
703 | - if ($board->nbtodolate > 0) { |
|
704 | - $boxwork .= '<div class="dashboardlinelatecoin nowrap">'; |
|
705 | - $boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late) . '">'; |
|
706 | - //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"'); |
|
707 | - $boxwork .= img_picto( |
|
708 | - $textlate, |
|
709 | - "warning_white", |
|
710 | - 'class="inline-block hideonsmartphone valigntextbottom"' |
|
711 | - ); |
|
712 | - $boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">'; |
|
713 | - $boxwork .= $board->nbtodolate; |
|
714 | - $boxwork .= '</span>'; |
|
715 | - $boxwork .= '</a>'; |
|
716 | - $boxwork .= '</div>'; |
|
717 | - } |
|
718 | - $boxwork .= '</div></div>'; |
|
719 | - $boxwork .= "\n"; |
|
720 | - } |
|
721 | - |
|
722 | - $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
723 | - $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
724 | - $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
725 | - $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
726 | - |
|
727 | - $boxwork .= '</div>'; |
|
728 | - $boxwork .= '</td></tr>'; |
|
729 | - } else { |
|
730 | - $boxwork .= '<tr class="nohover">'; |
|
731 | - $boxwork .= '<td class="nohover valignmiddle opacitymedium">'; |
|
732 | - $boxwork .= $langs->trans("NoOpenedElementToProcess"); |
|
733 | - $boxwork .= '</td>'; |
|
734 | - $boxwork .= '</tr>'; |
|
735 | - } |
|
736 | - |
|
737 | - $boxwork .= '</td></tr>'; |
|
738 | - |
|
739 | - $boxwork .= '</table>'; // End table array of working board |
|
740 | - $boxwork .= '</div>'; |
|
741 | - |
|
742 | - if (!empty($isIntopOpenedDashBoard)) { |
|
743 | - print '<div class="fichecenter">'; |
|
744 | - print '<div class="opened-dash-board-wrap"><div class="box-flex-container">' . $openedDashBoard . '</div></div>'; |
|
745 | - print '</div>'; |
|
746 | - } |
|
176 | + $showweather = (!getDolGlobalString('MAIN_DISABLE_METEO') || getDolGlobalInt('MAIN_DISABLE_METEO') == 2) ? 1 : 0; |
|
177 | + |
|
178 | + //Array that contains all WorkboardResponse classes to process them |
|
179 | + $dashboardlines = array(); |
|
180 | + |
|
181 | + // Number of actions to do (late) |
|
182 | + if (isModEnabled('agenda') && !getDolGlobalString('MAIN_DISABLE_BLOCK_AGENDA') && $user->hasRight('agenda', 'myactions', 'read')) { |
|
183 | + $board = new ActionComm($db); |
|
184 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
185 | + } |
|
186 | + |
|
187 | + // Number of project opened |
|
188 | + if (isModEnabled('project') && !getDolGlobalString('MAIN_DISABLE_BLOCK_PROJECT') && $user->hasRight('projet', 'lire')) { |
|
189 | + $board = new Project($db); |
|
190 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
191 | + } |
|
192 | + |
|
193 | + // Number of tasks to do (late) |
|
194 | + if (isModEnabled('project') && !getDolGlobalString('MAIN_DISABLE_BLOCK_PROJECT') && !getDolGlobalString('PROJECT_HIDE_TASKS') && $user->hasRight('projet', 'lire')) { |
|
195 | + $board = new Task($db); |
|
196 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
197 | + } |
|
198 | + |
|
199 | + // Number of commercial customer proposals open (expired) |
|
200 | + if (isModEnabled('propal') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('propal', 'read')) { |
|
201 | + $board = new Propal($db); |
|
202 | + $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
203 | + // Number of commercial proposals CLOSED signed (billed) |
|
204 | + $dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed"); |
|
205 | + } |
|
206 | + |
|
207 | + // Number of supplier proposals open (expired) |
|
208 | + if (isModEnabled('supplier_proposal') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('supplier_proposal', 'lire')) { |
|
209 | + $langs->load("supplier_proposal"); |
|
210 | + $board = new SupplierProposal($db); |
|
211 | + $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
212 | + // Number of commercial proposals CLOSED signed (billed) |
|
213 | + $dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed"); |
|
214 | + } |
|
215 | + |
|
216 | + // Number of sales orders |
|
217 | + if (isModEnabled('order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('commande', 'lire')) { |
|
218 | + $board = new Commande($db); |
|
219 | + // Number of customer orders to be shipped (validated and in progress) |
|
220 | + $dashboardlines[$board->element . '_toship'] = $board->load_board($user, 'toship'); |
|
221 | + // Number of customer orders to be billed (not visible by default, does not match a lot of organization). |
|
222 | + if (getDolGlobalInt('ORDER_BILL_AFTER_VALIDATION')) { |
|
223 | + $dashboardlines[$board->element . '_tobill'] = $board->load_board($user, 'tobill'); |
|
224 | + } |
|
225 | + // Number of customer orders to be billed (delivered but not billed) |
|
226 | + $dashboardlines[$board->element . '_shippedtobill'] = $board->load_board($user, 'shippedtobill'); |
|
227 | + } |
|
228 | + |
|
229 | + // Number of suppliers orders |
|
230 | + if (isModEnabled('supplier_order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('fournisseur', 'commande', 'lire')) { |
|
231 | + $board = new CommandeFournisseur($db); |
|
232 | + $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
233 | + $dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting'); |
|
234 | + } |
|
235 | + |
|
236 | + // Number of contract / services enabled (delayed) |
|
237 | + if (isModEnabled('contract') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CONTRACT') && $user->hasRight('contrat', 'lire')) { |
|
238 | + $board = new Contrat($db); |
|
239 | + $dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive"); |
|
240 | + // Number of active services (expired) |
|
241 | + $dashboardlines[$board->element . '_active'] = $board->load_board($user, "active"); |
|
242 | + } |
|
243 | + |
|
244 | + // Number of tickets open |
|
245 | + if (isModEnabled('ticket') && !getDolGlobalString('MAIN_DISABLE_BLOCK_TICKET') && $user->hasRight('ticket', 'read')) { |
|
246 | + $board = new Ticket($db); |
|
247 | + $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
|
248 | + // Number of active services (expired) |
|
249 | + //$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active"); |
|
250 | + } |
|
251 | + |
|
252 | + // Number of invoices customers (paid) |
|
253 | + if (isModEnabled('invoice') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('facture', 'lire')) { |
|
254 | + $board = new Facture($db); |
|
255 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
256 | + } |
|
257 | + |
|
258 | + // Number of supplier invoices (paid) |
|
259 | + if (isModEnabled('supplier_invoice') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('fournisseur', 'facture', 'lire')) { |
|
260 | + $board = new FactureFournisseur($db); |
|
261 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
262 | + } |
|
263 | + |
|
264 | + // Number of transactions to conciliate |
|
265 | + if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
266 | + $board = new Account($db); |
|
267 | + $nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate |
|
268 | + if ($nb > 0) { |
|
269 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
270 | + } |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + // Number of cheque to send |
|
275 | + if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
276 | + if (!getDolGlobalString('BANK_DISABLE_CHECK_DEPOSIT')) { |
|
277 | + include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; |
|
278 | + $board = new RemiseCheque($db); |
|
279 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
280 | + } |
|
281 | + if (isModEnabled('prelevement')) { |
|
282 | + include_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php'; |
|
283 | + $board = new BonPrelevement($db); |
|
284 | + $dashboardlines[$board->element . '_direct_debit'] = $board->load_board($user, 'direct_debit'); |
|
285 | + } |
|
286 | + if (isModEnabled('paymentbybanktransfer')) { |
|
287 | + include_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php'; |
|
288 | + $board = new BonPrelevement($db); |
|
289 | + $dashboardlines[$board->element . '_credit_transfer'] = $board->load_board($user, 'credit_transfer'); |
|
290 | + } |
|
291 | + } |
|
292 | + |
|
293 | + // Number of foundation members |
|
294 | + if (isModEnabled('member') && !getDolGlobalString('MAIN_DISABLE_BLOCK_ADHERENT') && $user->hasRight('adherent', 'lire') && !$user->socid) { |
|
295 | + $board = new Adherent($db); |
|
296 | + $dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift'); |
|
297 | + $dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired'); |
|
298 | + } |
|
299 | + |
|
300 | + // Number of expense reports to approve |
|
301 | + if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'approve')) { |
|
302 | + $board = new ExpenseReport($db); |
|
303 | + $dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove'); |
|
304 | + } |
|
305 | + |
|
306 | + // Number of expense reports to pay |
|
307 | + if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'to_paid')) { |
|
308 | + $board = new ExpenseReport($db); |
|
309 | + $dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay'); |
|
310 | + } |
|
311 | + |
|
312 | + // Number of holidays to approve |
|
313 | + if (isModEnabled('holiday') && !getDolGlobalString('MAIN_DISABLE_BLOCK_HOLIDAY') && $user->hasRight('holiday', 'approve')) { |
|
314 | + $board = new Holiday($db); |
|
315 | + $dashboardlines[$board->element] = $board->load_board($user); |
|
316 | + } |
|
317 | + |
|
318 | + $object = new stdClass(); |
|
319 | + $parameters = array(); |
|
320 | + $action = ''; |
|
321 | + $reshook = $hookmanager->executeHooks( |
|
322 | + 'addOpenElementsDashboardLine', |
|
323 | + $parameters, |
|
324 | + $object, |
|
325 | + $action |
|
326 | + ); // Note that $action and $object may have been modified by some hooks |
|
327 | + if ($reshook == 0) { |
|
328 | + $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); |
|
329 | + } |
|
330 | + |
|
331 | + /* Open object dashboard */ |
|
332 | + $dashboardgroup = array( |
|
333 | + 'action' => |
|
334 | + array( |
|
335 | + 'groupName' => 'Agenda', |
|
336 | + 'stats' => array('action'), |
|
337 | + ), |
|
338 | + 'project' => |
|
339 | + array( |
|
340 | + 'groupName' => 'Projects', |
|
341 | + 'globalStatsKey' => 'projects', |
|
342 | + 'stats' => array('project', 'project_task'), |
|
343 | + ), |
|
344 | + 'propal' => |
|
345 | + array( |
|
346 | + 'groupName' => 'Proposals', |
|
347 | + 'globalStatsKey' => 'proposals', |
|
348 | + 'stats' => |
|
349 | + array('propal_opened', 'propal_signed'), |
|
350 | + ), |
|
351 | + 'commande' => |
|
352 | + array( |
|
353 | + 'groupName' => 'Orders', |
|
354 | + 'globalStatsKey' => 'orders', |
|
355 | + 'stats' => |
|
356 | + array('commande_toship', 'commande_tobill', 'commande_shippedtobill'), |
|
357 | + ), |
|
358 | + 'facture' => |
|
359 | + array( |
|
360 | + 'groupName' => 'Invoices', |
|
361 | + 'globalStatsKey' => 'invoices', |
|
362 | + 'stats' => |
|
363 | + array('facture'), |
|
364 | + ), |
|
365 | + 'supplier_proposal' => |
|
366 | + array( |
|
367 | + 'lang' => 'supplier_proposal', |
|
368 | + 'groupName' => 'SupplierProposals', |
|
369 | + 'globalStatsKey' => 'askprice', |
|
370 | + 'stats' => |
|
371 | + array('supplier_proposal_opened', 'supplier_proposal_signed'), |
|
372 | + ), |
|
373 | + 'order_supplier' => |
|
374 | + array( |
|
375 | + 'groupName' => 'SuppliersOrders', |
|
376 | + 'globalStatsKey' => 'supplier_orders', |
|
377 | + 'stats' => |
|
378 | + array('order_supplier_opened', 'order_supplier_awaiting'), |
|
379 | + ), |
|
380 | + 'invoice_supplier' => |
|
381 | + array( |
|
382 | + 'groupName' => 'BillsSuppliers', |
|
383 | + 'globalStatsKey' => 'supplier_invoices', |
|
384 | + 'stats' => |
|
385 | + array('invoice_supplier'), |
|
386 | + ), |
|
387 | + 'contrat' => |
|
388 | + array( |
|
389 | + 'groupName' => 'Contracts', |
|
390 | + 'globalStatsKey' => 'Contracts', |
|
391 | + 'stats' => |
|
392 | + array('contrat_inactive', 'contrat_active'), |
|
393 | + ), |
|
394 | + 'ticket' => |
|
395 | + array( |
|
396 | + 'groupName' => 'Tickets', |
|
397 | + 'globalStatsKey' => 'ticket', |
|
398 | + 'stats' => |
|
399 | + array('ticket_opened'), |
|
400 | + ), |
|
401 | + 'bank_account' => |
|
402 | + array( |
|
403 | + 'groupName' => 'BankAccount', |
|
404 | + 'stats' => |
|
405 | + array('bank_account', 'chequereceipt', 'widthdraw_direct_debit', 'widthdraw_credit_transfer'), |
|
406 | + ), |
|
407 | + 'member' => |
|
408 | + array( |
|
409 | + 'groupName' => 'Members', |
|
410 | + 'globalStatsKey' => 'members', |
|
411 | + 'stats' => |
|
412 | + array('member_shift', 'member_expired'), |
|
413 | + ), |
|
414 | + 'expensereport' => |
|
415 | + array( |
|
416 | + 'groupName' => 'ExpenseReport', |
|
417 | + 'globalStatsKey' => 'expensereports', |
|
418 | + 'stats' => |
|
419 | + array('expensereport_toapprove', 'expensereport_topay'), |
|
420 | + ), |
|
421 | + 'holiday' => |
|
422 | + array( |
|
423 | + 'groupName' => 'Holidays', |
|
424 | + 'globalStatsKey' => 'holidays', |
|
425 | + 'stats' => |
|
426 | + array('holiday'), |
|
427 | + ), |
|
428 | + ); |
|
429 | + |
|
430 | + $object = new stdClass(); |
|
431 | + $parameters = array( |
|
432 | + 'dashboardgroup' => $dashboardgroup |
|
433 | + ); |
|
434 | + $reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
435 | + if ($reshook == 0) { |
|
436 | + $dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray); |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + // Calculate total nb of late |
|
441 | + $totallate = $totaltodo = 0; |
|
442 | + |
|
443 | + //Remove any invalid response |
|
444 | + //load_board can return an integer if failed, or WorkboardResponse if OK |
|
445 | + $valid_dashboardlines = array(); |
|
446 | + foreach ($dashboardlines as $workboardid => $tmp) { |
|
447 | + if ($tmp instanceof WorkboardResponse) { |
|
448 | + $tmp->id = $workboardid; // Complete the object to add its id into its name |
|
449 | + $valid_dashboardlines[$workboardid] = $tmp; |
|
450 | + } |
|
451 | + } |
|
452 | + |
|
453 | + // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop |
|
454 | + foreach ($valid_dashboardlines as $board) { |
|
455 | + if (is_numeric($board->nbtodo) && is_numeric($board->nbtodolate) && $board->nbtodolate > 0) { |
|
456 | + $totaltodo += $board->nbtodo; |
|
457 | + $totallate += $board->nbtodolate; |
|
458 | + } |
|
459 | + } |
|
460 | + |
|
461 | + $openedDashBoardSize = 'info-box-sm'; // use sm by default |
|
462 | + foreach ($dashboardgroup as $dashbordelement) { |
|
463 | + if (is_array($dashbordelement['stats']) && count($dashbordelement['stats']) > 2) { |
|
464 | + $openedDashBoardSize = ''; // use default info box size : big |
|
465 | + break; |
|
466 | + } |
|
467 | + } |
|
468 | + |
|
469 | + $totalLateNumber = $totallate; |
|
470 | + $totallatePercentage = ((!empty($totaltodo)) ? round($totallate / $totaltodo * 100, 2) : 0); |
|
471 | + if (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE')) { |
|
472 | + $totallate = $totallatePercentage; |
|
473 | + } |
|
474 | + |
|
475 | + $boxwork = ''; |
|
476 | + $boxwork .= '<div class="box">'; |
|
477 | + $boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">' . "\n"; |
|
478 | + $boxwork .= '<tr class="liste_titre">'; |
|
479 | + $boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">' . $langs->trans("DolibarrWorkBoard") . '</div>'; |
|
480 | + if ($showweather) { |
|
481 | + if ($totallate > 0) { |
|
482 | + $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv( |
|
483 | + "NActionsLate", |
|
484 | + $totallate . (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE') ? '%' : '') |
|
485 | + ) . ')'; |
|
486 | + } else { |
|
487 | + $text = $langs->transnoentitiesnoconv("NoItemLate"); |
|
488 | + } |
|
489 | + $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); |
|
490 | + //$text.=$form->textwithpicto('',$langs->trans("LateDesc")); |
|
491 | + $options = 'height="24px" style="float: right"'; |
|
492 | + $boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle'); |
|
493 | + } |
|
494 | + $boxwork .= '</th>'; |
|
495 | + $boxwork .= '</tr>' . "\n"; |
|
496 | + |
|
497 | + // Show dashboard |
|
498 | + $nbworkboardempty = 0; |
|
499 | + $isIntopOpenedDashBoard = $globalStatInTopOpenedDashBoard = array(); |
|
500 | + if (!empty($valid_dashboardlines)) { |
|
501 | + $openedDashBoard = ''; |
|
502 | + |
|
503 | + $boxwork .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">'; |
|
504 | + |
|
505 | + foreach ($dashboardgroup as $groupKey => $groupElement) { |
|
506 | + $boards = array(); |
|
507 | + |
|
508 | + // Scan $groupElement and save the one with 'stats' that must be used for the open objects dashboard |
|
509 | + if (!getDolGlobalString('MAIN_DISABLE_NEW_OPENED_DASH_BOARD')) { |
|
510 | + foreach ($groupElement['stats'] as $infoKey) { |
|
511 | + if (!empty($valid_dashboardlines[$infoKey])) { |
|
512 | + $boards[] = $valid_dashboardlines[$infoKey]; |
|
513 | + $isIntopOpenedDashBoard[] = $infoKey; |
|
514 | + } |
|
515 | + } |
|
516 | + } |
|
517 | + |
|
518 | + if (!empty($boards)) { |
|
519 | + if (!empty($groupElement['lang'])) { |
|
520 | + $langs->load($groupElement['lang']); |
|
521 | + } |
|
522 | + $groupName = $langs->trans($groupElement['groupName']); |
|
523 | + $groupKeyLowerCase = strtolower($groupKey); |
|
524 | + |
|
525 | + // global stats |
|
526 | + $globalStatsKey = false; |
|
527 | + if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])) { // can be filled by hook |
|
528 | + $globalStatsKey = $groupElement['globalStatsKey']; |
|
529 | + $groupElement['globalStats'] = array(); |
|
530 | + } |
|
531 | + |
|
532 | + $openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">' . "\n"; |
|
533 | + $openedDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . '">' . "\n"; |
|
534 | + $openedDashBoard .= ' <span class="info-box-icon bg-infobox-' . $groupKeyLowerCase . '">' . "\n"; |
|
535 | + $openedDashBoard .= ' <i class="fa fa-dol-' . $groupKeyLowerCase . '"></i>' . "\n"; |
|
536 | + |
|
537 | + // Show the span for the total of record. TODO This seems not used. |
|
538 | + if (!empty($groupElement['globalStats'])) { |
|
539 | + $globalStatInTopOpenedDashBoard[] = $globalStatsKey; |
|
540 | + $openedDashBoard .= '<span class="info-box-icon-text" title="' . $groupElement['globalStats']['text'] . '">' . $groupElement['globalStats']['nbTotal'] . '</span>'; |
|
541 | + } |
|
542 | + |
|
543 | + $openedDashBoard .= '</span>' . "\n"; |
|
544 | + $openedDashBoard .= '<div class="info-box-content">' . "\n"; |
|
545 | + |
|
546 | + $openedDashBoard .= '<div class="info-box-title" title="' . strip_tags($groupName) . '">' . $groupName . '</div>' . "\n"; |
|
547 | + $openedDashBoard .= '<div class="info-box-lines">' . "\n"; |
|
548 | + |
|
549 | + foreach ($boards as $board) { |
|
550 | + $openedDashBoard .= '<div class="info-box-line spanoverflow nowrap">'; |
|
551 | + |
|
552 | + if (!empty($board->labelShort)) { |
|
553 | + $infoName = '<div class="marginrightonly inline-block valignmiddle info-box-line-text" title="' . $board->label . '">' . $board->labelShort . '</div>'; |
|
554 | + } else { |
|
555 | + $infoName = '<div class="marginrightonly inline-block valignmiddle info-box-line-text">' . $board->label . '</div>'; |
|
556 | + } |
|
557 | + |
|
558 | + $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate); |
|
559 | + $textLateTitle .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil(empty($board->warning_delay) ? 0 : $board->warning_delay) >= 0 ? '+' : '') . ceil(empty($board->warning_delay) ? 0 : $board->warning_delay) . ' ' . $langs->trans("days") . ')'; |
|
560 | + |
|
561 | + if ($board->id == 'bank_account') { |
|
562 | + $textLateTitle .= '<br><span class="opacitymedium">' . $langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")) . '</span>'; |
|
563 | + } |
|
564 | + |
|
565 | + $textLate = ''; |
|
566 | + if ($board->nbtodolate > 0) { |
|
567 | + $textLate .= '<span title="' . dol_escape_htmltag($textLateTitle) . '" class="classfortooltip badge badge-warning">'; |
|
568 | + $textLate .= '<i class="fa fa-exclamation-triangle"></i> ' . $board->nbtodolate; |
|
569 | + $textLate .= '</span>'; |
|
570 | + } |
|
571 | + |
|
572 | + $nbtodClass = ''; |
|
573 | + if ($board->nbtodo > 0) { |
|
574 | + $nbtodClass = 'badge badge-info'; |
|
575 | + } else { |
|
576 | + $nbtodClass = 'opacitymedium'; |
|
577 | + } |
|
578 | + |
|
579 | + // Forge the line to show into the open object box |
|
580 | + $labeltoshow = $board->label . ' (' . $board->nbtodo . ')'; |
|
581 | + if ($board->total > 0) { |
|
582 | + $labeltoshow .= ' - ' . price($board->total, 0, $langs, 1, -1, -1, $conf->currency); |
|
583 | + } |
|
584 | + $openedDashBoard .= '<a href="' . $board->url . '" class="info-box-text info-box-text-a">'; |
|
585 | + $openedDashBoard .= $infoName; |
|
586 | + $openedDashBoard .= '<div class="inline-block nowraponall">'; |
|
587 | + $openedDashBoard .= '<span class="classfortooltip' . ($nbtodClass ? ' ' . $nbtodClass : '') . '" title="' . $labeltoshow . '">'; |
|
588 | + $openedDashBoard .= $board->nbtodo; |
|
589 | + if ($board->total > 0 && getDolGlobalString('MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX')) { |
|
590 | + $openedDashBoard .= ' : ' . price($board->total, 0, $langs, 1, -1, -1, $conf->currency); |
|
591 | + } |
|
592 | + $openedDashBoard .= '</span>'; |
|
593 | + |
|
594 | + if ($textLate) { |
|
595 | + if ($board->url_late) { |
|
596 | + $openedDashBoard .= '</div></a>'; |
|
597 | + $openedDashBoard .= ' <div class="inline-block"><a href="' . $board->url_late . '" class="info-box-text info-box-text-a paddingleft">'; |
|
598 | + } else { |
|
599 | + $openedDashBoard .= ' '; |
|
600 | + } |
|
601 | + $openedDashBoard .= $textLate; |
|
602 | + } |
|
603 | + $openedDashBoard .= '</a>' . "\n"; |
|
604 | + $openedDashBoard .= '</div>'; |
|
605 | + $openedDashBoard .= '</div>' . "\n"; |
|
606 | + } |
|
607 | + |
|
608 | + // TODO Add hook here to add more "info-box-line" |
|
609 | + |
|
610 | + $openedDashBoard .= ' </div><!-- /.info-box-lines --></div><!-- /.info-box-content -->' . "\n"; |
|
611 | + $openedDashBoard .= ' </div><!-- /.info-box -->' . "\n"; |
|
612 | + $openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->' . "\n"; |
|
613 | + $openedDashBoard .= '</div><!-- /.box-flex-item -->' . "\n"; |
|
614 | + $openedDashBoard .= "\n"; |
|
615 | + } |
|
616 | + } |
|
617 | + |
|
618 | + if ($showweather && !empty($isIntopOpenedDashBoard)) { |
|
619 | + $appendClass = (getDolGlobalInt('MAIN_DISABLE_METEO') == 2 ? ' hideonsmartphone' : ''); |
|
620 | + $weather = getWeatherStatus($totallate); |
|
621 | + |
|
622 | + $text = ''; |
|
623 | + if ($totallate > 0) { |
|
624 | + $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv( |
|
625 | + "NActionsLate", |
|
626 | + $totallate . (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE') ? '%' : '') |
|
627 | + ) . ')'; |
|
628 | + } else { |
|
629 | + $text = $langs->transnoentitiesnoconv("NoItemLate"); |
|
630 | + } |
|
631 | + $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); |
|
632 | + |
|
633 | + $weatherDashBoard = '<div class="box-flex-item ' . $appendClass . '"><div class="box-flex-item-with-margin">' . "\n"; |
|
634 | + $weatherDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . ' info-box-weather info-box-weather-level' . $weather->level . '">' . "\n"; |
|
635 | + $weatherDashBoard .= ' <span class="info-box-icon">'; |
|
636 | + $weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50'); |
|
637 | + $weatherDashBoard .= ' </span>' . "\n"; |
|
638 | + $weatherDashBoard .= ' <div class="info-box-content">' . "\n"; |
|
639 | + $weatherDashBoard .= ' <div class="info-box-title">' . $langs->trans('GlobalOpenedElemView') . '</div>' . "\n"; |
|
640 | + |
|
641 | + if ($totallatePercentage > 0 && getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE')) { |
|
642 | + $weatherDashBoard .= ' <span class="info-box-number">' . $langs->transnoentitiesnoconv( |
|
643 | + "NActionsLate", |
|
644 | + price($totallatePercentage) . '%' |
|
645 | + ) . '</span>' . "\n"; |
|
646 | + $weatherDashBoard .= ' <span class="progress-description">' . $langs->trans( |
|
647 | + 'NActionsLate', |
|
648 | + $totalLateNumber |
|
649 | + ) . '</span>' . "\n"; |
|
650 | + } else { |
|
651 | + $weatherDashBoard .= ' <span class="info-box-number">' . $langs->transnoentitiesnoconv( |
|
652 | + "NActionsLate", |
|
653 | + $totalLateNumber |
|
654 | + ) . '</span>' . "\n"; |
|
655 | + if ($totallatePercentage > 0) { |
|
656 | + $weatherDashBoard .= ' <span class="progress-description">' . $langs->trans( |
|
657 | + 'NActionsLate', |
|
658 | + price($totallatePercentage) . '%' |
|
659 | + ) . '</span>' . "\n"; |
|
660 | + } |
|
661 | + } |
|
662 | + |
|
663 | + $weatherDashBoard .= ' </div><!-- /.info-box-content -->' . "\n"; |
|
664 | + $weatherDashBoard .= ' </div><!-- /.info-box -->' . "\n"; |
|
665 | + $weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->' . "\n"; |
|
666 | + $weatherDashBoard .= '</div><!-- /.box-flex-item -->' . "\n"; |
|
667 | + $weatherDashBoard .= "\n"; |
|
668 | + |
|
669 | + $openedDashBoard = $weatherDashBoard . $openedDashBoard; |
|
670 | + } |
|
671 | + |
|
672 | + if (!empty($isIntopOpenedDashBoard)) { |
|
673 | + for ($i = 1; $i <= 10; $i++) { |
|
674 | + $openedDashBoard .= '<div class="box-flex-item filler"></div>'; |
|
675 | + } |
|
676 | + } |
|
677 | + |
|
678 | + $nbworkboardcount = 0; |
|
679 | + foreach ($valid_dashboardlines as $infoKey => $board) { |
|
680 | + if (in_array($infoKey, $isIntopOpenedDashBoard)) { |
|
681 | + // skip if info is present on top |
|
682 | + continue; |
|
683 | + } |
|
684 | + |
|
685 | + if (empty($board->nbtodo)) { |
|
686 | + $nbworkboardempty++; |
|
687 | + } |
|
688 | + $nbworkboardcount++; |
|
689 | + |
|
690 | + |
|
691 | + $textlate = $langs->trans("NActionsLate", $board->nbtodolate); |
|
692 | + $textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')'; |
|
693 | + |
|
694 | + |
|
695 | + $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">'; |
|
696 | + $boxwork .= '<div class="boxstatscontent">'; |
|
697 | + $boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' <span>' . $board->label . '</span></span><br>'; |
|
698 | + $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>'; |
|
699 | + if ($board->total > 0 && getDolGlobalString('MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX')) { |
|
700 | + $boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>'; |
|
701 | + } |
|
702 | + $boxwork .= '</div>'; |
|
703 | + if ($board->nbtodolate > 0) { |
|
704 | + $boxwork .= '<div class="dashboardlinelatecoin nowrap">'; |
|
705 | + $boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late) . '">'; |
|
706 | + //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"'); |
|
707 | + $boxwork .= img_picto( |
|
708 | + $textlate, |
|
709 | + "warning_white", |
|
710 | + 'class="inline-block hideonsmartphone valigntextbottom"' |
|
711 | + ); |
|
712 | + $boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">'; |
|
713 | + $boxwork .= $board->nbtodolate; |
|
714 | + $boxwork .= '</span>'; |
|
715 | + $boxwork .= '</a>'; |
|
716 | + $boxwork .= '</div>'; |
|
717 | + } |
|
718 | + $boxwork .= '</div></div>'; |
|
719 | + $boxwork .= "\n"; |
|
720 | + } |
|
721 | + |
|
722 | + $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
723 | + $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
724 | + $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
725 | + $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>'; |
|
726 | + |
|
727 | + $boxwork .= '</div>'; |
|
728 | + $boxwork .= '</td></tr>'; |
|
729 | + } else { |
|
730 | + $boxwork .= '<tr class="nohover">'; |
|
731 | + $boxwork .= '<td class="nohover valignmiddle opacitymedium">'; |
|
732 | + $boxwork .= $langs->trans("NoOpenedElementToProcess"); |
|
733 | + $boxwork .= '</td>'; |
|
734 | + $boxwork .= '</tr>'; |
|
735 | + } |
|
736 | + |
|
737 | + $boxwork .= '</td></tr>'; |
|
738 | + |
|
739 | + $boxwork .= '</table>'; // End table array of working board |
|
740 | + $boxwork .= '</div>'; |
|
741 | + |
|
742 | + if (!empty($isIntopOpenedDashBoard)) { |
|
743 | + print '<div class="fichecenter">'; |
|
744 | + print '<div class="opened-dash-board-wrap"><div class="box-flex-container">' . $openedDashBoard . '</div></div>'; |
|
745 | + print '</div>'; |
|
746 | + } |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | |
761 | 761 | $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">'; |
762 | 762 | if (!empty($nbworkboardcount)) { |
763 | - $boxlist .= $boxwork; |
|
763 | + $boxlist .= $boxwork; |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | $boxlist .= $resultboxes['boxlista']; |
@@ -800,10 +800,10 @@ discard block |
||
800 | 800 | */ |
801 | 801 | function showWeather($totallate, $text, $options, $morecss = '') |
802 | 802 | { |
803 | - global $conf; |
|
803 | + global $conf; |
|
804 | 804 | |
805 | - $weather = getWeatherStatus($totallate); |
|
806 | - return img_weather($text, $weather->picto, $options, 0, $morecss); |
|
805 | + $weather = getWeatherStatus($totallate); |
|
806 | + return img_weather($text, $weather->picto, $options, 0, $morecss); |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | |
@@ -815,40 +815,40 @@ discard block |
||
815 | 815 | */ |
816 | 816 | function getWeatherStatus($totallate) |
817 | 817 | { |
818 | - $weather = new stdClass(); |
|
819 | - $weather->picto = ''; |
|
820 | - |
|
821 | - $offset = 0; |
|
822 | - $factor = 10; // By default |
|
823 | - |
|
824 | - $used_conf = (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE') ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'); |
|
825 | - |
|
826 | - $weather->level = 0; |
|
827 | - $level0 = $offset; |
|
828 | - $level0 = getDolGlobalString($used_conf . '0', $level0); |
|
829 | - $level1 = $offset + $factor; |
|
830 | - $level1 = getDolGlobalString($used_conf . '1', $level1); |
|
831 | - $level2 = $offset + 2 * $factor; |
|
832 | - $level2 = getDolGlobalString($used_conf . '2', $level2); |
|
833 | - $level3 = $offset + 3 * $factor; |
|
834 | - $level3 = getDolGlobalString($used_conf . '3', $level3); |
|
835 | - |
|
836 | - if ($totallate <= $level0) { |
|
837 | - $weather->picto = 'weather-clear.png'; |
|
838 | - $weather->level = 0; |
|
839 | - } elseif ($totallate <= $level1) { |
|
840 | - $weather->picto = 'weather-few-clouds.png'; |
|
841 | - $weather->level = 1; |
|
842 | - } elseif ($totallate <= $level2) { |
|
843 | - $weather->picto = 'weather-clouds.png'; |
|
844 | - $weather->level = 2; |
|
845 | - } elseif ($totallate <= $level3) { |
|
846 | - $weather->picto = 'weather-many-clouds.png'; |
|
847 | - $weather->level = 3; |
|
848 | - } else { |
|
849 | - $weather->picto = 'weather-storm.png'; |
|
850 | - $weather->level = 4; |
|
851 | - } |
|
852 | - |
|
853 | - return $weather; |
|
818 | + $weather = new stdClass(); |
|
819 | + $weather->picto = ''; |
|
820 | + |
|
821 | + $offset = 0; |
|
822 | + $factor = 10; // By default |
|
823 | + |
|
824 | + $used_conf = (getDolGlobalString('MAIN_USE_METEO_WITH_PERCENTAGE') ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'); |
|
825 | + |
|
826 | + $weather->level = 0; |
|
827 | + $level0 = $offset; |
|
828 | + $level0 = getDolGlobalString($used_conf . '0', $level0); |
|
829 | + $level1 = $offset + $factor; |
|
830 | + $level1 = getDolGlobalString($used_conf . '1', $level1); |
|
831 | + $level2 = $offset + 2 * $factor; |
|
832 | + $level2 = getDolGlobalString($used_conf . '2', $level2); |
|
833 | + $level3 = $offset + 3 * $factor; |
|
834 | + $level3 = getDolGlobalString($used_conf . '3', $level3); |
|
835 | + |
|
836 | + if ($totallate <= $level0) { |
|
837 | + $weather->picto = 'weather-clear.png'; |
|
838 | + $weather->level = 0; |
|
839 | + } elseif ($totallate <= $level1) { |
|
840 | + $weather->picto = 'weather-few-clouds.png'; |
|
841 | + $weather->level = 1; |
|
842 | + } elseif ($totallate <= $level2) { |
|
843 | + $weather->picto = 'weather-clouds.png'; |
|
844 | + $weather->level = 2; |
|
845 | + } elseif ($totallate <= $level3) { |
|
846 | + $weather->picto = 'weather-many-clouds.png'; |
|
847 | + $weather->level = 3; |
|
848 | + } else { |
|
849 | + $weather->picto = 'weather-storm.png'; |
|
850 | + $weather->level = 4; |
|
851 | + } |
|
852 | + |
|
853 | + return $weather; |
|
854 | 854 | } |