@@ -23,7 +23,9 @@ |
||
23 | 23 | * \brief Main page for ECM section area |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
26 | +if (! defined('DISABLE_JS_GRAHP')) { |
|
27 | + define('DISABLE_JS_GRAPH', 1); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | require '../main.inc.php'; |
29 | 31 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | define('NOSTYLECHECK', 1); |
27 | 27 | define('USEDOLIBARREDITOR', 1); |
28 | 28 | define('FORCE_CKEDITOR', 1); // We need CKEditor, even if module is off. |
29 | -if (!defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
29 | +if (!defined('DISABLE_JS_GRAHP')) { |
|
30 | + define('DISABLE_JS_GRAPH', 1); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | //header('X-XSS-Protection:0'); // Disable XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. |
32 | 34 | |
@@ -592,7 +594,9 @@ discard block |
||
592 | 594 | $arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml')); |
593 | 595 | foreach ($arrayotherlang as $key => $val) { |
594 | 596 | // It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,' |
595 | - if (empty(trim($val))) continue; |
|
597 | + if (empty(trim($val))) { |
|
598 | + continue; |
|
599 | + } |
|
596 | 600 | $arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only |
597 | 601 | } |
598 | 602 | |
@@ -1336,7 +1340,9 @@ discard block |
||
1336 | 1340 | $arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml')); |
1337 | 1341 | foreach ($arrayotherlang as $key => $val) { |
1338 | 1342 | // It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,' |
1339 | - if (empty(trim($val))) continue; |
|
1343 | + if (empty(trim($val))) { |
|
1344 | + continue; |
|
1345 | + } |
|
1340 | 1346 | $arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only |
1341 | 1347 | } |
1342 | 1348 | |
@@ -1793,7 +1799,9 @@ discard block |
||
1793 | 1799 | // Under certain conditions $sublang can be an empty string |
1794 | 1800 | // ($object->otherlang with empty string or with string like this 'en,,sv') |
1795 | 1801 | // if is the case we try to re-delete the main alias file. Avoid it. |
1796 | - if (empty(trim($sublang))) continue; |
|
1802 | + if (empty(trim($sublang))) { |
|
1803 | + continue; |
|
1804 | + } |
|
1797 | 1805 | $fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename; |
1798 | 1806 | dol_delete_file($fileoldaliassub); |
1799 | 1807 | } |
@@ -1816,7 +1824,9 @@ discard block |
||
1816 | 1824 | // Under certain conditions $ sublang can be an empty string |
1817 | 1825 | // ($object->otherlang with empty string or with string like this 'en,,sv') |
1818 | 1826 | // if is the case we try to re-delete the main alias file. Avoid it. |
1819 | - if (empty(trim($sublang))) continue; |
|
1827 | + if (empty(trim($sublang))) { |
|
1828 | + continue; |
|
1829 | + } |
|
1820 | 1830 | $fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename; |
1821 | 1831 | dol_delete_file($fileoldaliassub); |
1822 | 1832 | } |
@@ -2903,7 +2913,9 @@ discard block |
||
2903 | 2913 | $onlylang[$website->lang] = $website->lang.' ('.$langs->trans("Default").')'; |
2904 | 2914 | } |
2905 | 2915 | foreach (explode(',', $website->otherlang) as $langkey) { |
2906 | - if (empty(trim($langkey))) continue; |
|
2916 | + if (empty(trim($langkey))) { |
|
2917 | + continue; |
|
2918 | + } |
|
2907 | 2919 | $onlylang[$langkey] = $langkey; |
2908 | 2920 | } |
2909 | 2921 | $textifempty = $langs->trans("Default"); |
@@ -306,8 +306,12 @@ discard block |
||
306 | 306 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { |
307 | 307 | $outputlangs = $langs; |
308 | 308 | $newlang = ''; |
309 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
310 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
309 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
310 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
311 | + } |
|
312 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
313 | + $newlang = $object->thirdparty->default_lang; |
|
314 | + } |
|
311 | 315 | if (!empty($newlang)) { |
312 | 316 | $outputlangs = new Translate("", $conf); |
313 | 317 | $outputlangs->setDefaultLang($newlang); |
@@ -2477,9 +2481,12 @@ discard block |
||
2477 | 2481 | |
2478 | 2482 | $parameters = array(); |
2479 | 2483 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
2480 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2481 | - if (empty($reshook)) |
|
2482 | - $object->formAddObjectLine(1, $mysoc, $soc); |
|
2484 | + if ($reshook < 0) { |
|
2485 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2486 | + } |
|
2487 | + if (empty($reshook)) { |
|
2488 | + $object->formAddObjectLine(1, $mysoc, $soc); |
|
2489 | + } |
|
2483 | 2490 | } else { |
2484 | 2491 | $parameters = array(); |
2485 | 2492 | $reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
@@ -1170,7 +1170,9 @@ |
||
1170 | 1170 | if (GETPOST('contactid', 'int')) { |
1171 | 1171 | $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int'); |
1172 | 1172 | } |
1173 | - if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); |
|
1173 | + if ($origin=='contact') { |
|
1174 | + $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); |
|
1175 | + } |
|
1174 | 1176 | print img_picto('', 'contact', 'class="paddingrightonly"'); |
1175 | 1177 | print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); |
1176 | 1178 | print '</td></tr>'; |
@@ -1984,9 +1984,12 @@ |
||
1984 | 1984 | |
1985 | 1985 | $parameters = array(); |
1986 | 1986 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
1987 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1988 | - if (empty($reshook)) |
|
1989 | - $object->formAddObjectLine(1, $mysoc, $soc); |
|
1987 | + if ($reshook < 0) { |
|
1988 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1989 | + } |
|
1990 | + if (empty($reshook)) { |
|
1991 | + $object->formAddObjectLine(1, $mysoc, $soc); |
|
1992 | + } |
|
1990 | 1993 | } |
1991 | 1994 | |
1992 | 1995 | print '</table>'; |
@@ -118,7 +118,9 @@ |
||
118 | 118 | |
119 | 119 | if ($year) { |
120 | 120 | if (is_dir($dir.'/'.$year)) { |
121 | - if (!empty($year_dirs)) print '<br>'; |
|
121 | + if (!empty($year_dirs)) { |
|
122 | + print '<br>'; |
|
123 | + } |
|
122 | 124 | print '<br>'; |
123 | 125 | print '<table width="100%" class="noborder">'; |
124 | 126 | print '<tr class="liste_titre">'; |
@@ -1623,9 +1623,13 @@ |
||
1623 | 1623 | |
1624 | 1624 | $parameters = array(); |
1625 | 1625 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
1626 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1627 | - if (empty($reshook)) |
|
1628 | - $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice |
|
1626 | + if ($reshook < 0) { |
|
1627 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1628 | + } |
|
1629 | + if (empty($reshook)) { |
|
1630 | + $object->formAddObjectLine(0, $mysoc, $object->thirdparty); |
|
1631 | + } |
|
1632 | + // No date selector for template invoice |
|
1629 | 1633 | } |
1630 | 1634 | } |
1631 | 1635 |
@@ -421,8 +421,12 @@ discard block |
||
421 | 421 | while ($pagenb < $pageposafternote) { |
422 | 422 | $pdf->AddPage(); |
423 | 423 | $pagenb++; |
424 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
425 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
424 | + if (!empty($tplidx)) { |
|
425 | + $pdf->useTemplate($tplidx); |
|
426 | + } |
|
427 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
428 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
429 | + } |
|
426 | 430 | // $this->_pagefoot($pdf,$object,$outputlangs,1); |
427 | 431 | $pdf->setTopMargin($tab_top_newpage); |
428 | 432 | // The only function to edit the bottom margin of current page to set it. |
@@ -475,8 +479,12 @@ discard block |
||
475 | 479 | |
476 | 480 | // apply note frame to last page |
477 | 481 | $pdf->setPage($pageposafternote); |
478 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
479 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
482 | + if (!empty($tplidx)) { |
|
483 | + $pdf->useTemplate($tplidx); |
|
484 | + } |
|
485 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
486 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
487 | + } |
|
480 | 488 | $height_note = $posyafter - $tab_top_newpage; |
481 | 489 | $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); |
482 | 490 | } else // No pagebreak |
@@ -493,8 +501,12 @@ discard block |
||
493 | 501 | $pagenb++; |
494 | 502 | $pageposafternote++; |
495 | 503 | $pdf->setPage($pageposafternote); |
496 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
497 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
504 | + if (!empty($tplidx)) { |
|
505 | + $pdf->useTemplate($tplidx); |
|
506 | + } |
|
507 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
508 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
509 | + } |
|
498 | 510 | |
499 | 511 | $posyafter = $tab_top_newpage; |
500 | 512 | } |
@@ -65,8 +65,12 @@ discard block |
||
65 | 65 | $offset = $limit * $page; |
66 | 66 | $pageprev = $page - 1; |
67 | 67 | $pagenext = $page + 1; |
68 | -if (!$sortfield) $sortfield = "cr.date_sync"; |
|
69 | -if (!$sortorder) $sortorder = "ASC"; |
|
68 | +if (!$sortfield) { |
|
69 | + $sortfield = "cr.date_sync"; |
|
70 | +} |
|
71 | +if (!$sortorder) { |
|
72 | + $sortorder = "ASC"; |
|
73 | +} |
|
70 | 74 | |
71 | 75 | |
72 | 76 | // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks |
@@ -201,7 +205,9 @@ discard block |
||
201 | 205 | |
202 | 206 | $parameters = array(); |
203 | 207 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
204 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
208 | +if ($reshook < 0) { |
|
209 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
210 | +} |
|
205 | 211 | if (empty($reshook)) { |
206 | 212 | // Selection of new fields |
207 | 213 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
@@ -290,14 +296,20 @@ discard block |
||
290 | 296 | $sql .= $hookmanager->resPrint; |
291 | 297 | $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; |
292 | 298 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; |
293 | -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
|
299 | +if ($sall) { |
|
300 | + $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
|
301 | +} |
|
294 | 302 | if ($search_date_sync && $search_date_sync_end ) { |
295 | 303 | $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; |
296 | 304 | } elseif ($search_date_sync && !$search_date_sync_end) { |
297 | 305 | $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); |
298 | 306 | } |
299 | -if ($search_rate) $sql .= natural_search('cr.rate', $search_rate); |
|
300 | -if ($search_code) $sql .= natural_search('m.code', $search_code); |
|
307 | +if ($search_rate) { |
|
308 | + $sql .= natural_search('cr.rate', $search_rate); |
|
309 | +} |
|
310 | +if ($search_code) { |
|
311 | + $sql .= natural_search('m.code', $search_code); |
|
312 | +} |
|
301 | 313 | $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'"; |
302 | 314 | |
303 | 315 | // Add where from hooks |
@@ -347,10 +359,18 @@ discard block |
||
347 | 359 | $param .= "&sall=".urlencode($sall); |
348 | 360 | } |
349 | 361 | |
350 | - if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync; |
|
351 | - if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; |
|
352 | - if ($search_rate) $param = "&search_rate=".urlencode($search_rate); |
|
353 | - if ($search_code != '') $param.="&search_code=".urlencode($search_code); |
|
362 | + if ($search_date_sync) { |
|
363 | + $param = "&search_date_sync=".$search_date_sync; |
|
364 | + } |
|
365 | + if ($search_date_sync_end) { |
|
366 | + $param="&search_date_sync_end=".$search_date_sync_end; |
|
367 | + } |
|
368 | + if ($search_rate) { |
|
369 | + $param = "&search_rate=".urlencode($search_rate); |
|
370 | + } |
|
371 | + if ($search_code != '') { |
|
372 | + $param.="&search_code=".urlencode($search_code); |
|
373 | + } |
|
354 | 374 | |
355 | 375 | // Add $param from extra fields |
356 | 376 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
@@ -493,7 +513,9 @@ discard block |
||
493 | 513 | print '<td class="tdoverflowmax200">'; |
494 | 514 | print $obj->date_sync; |
495 | 515 | print "</td>\n"; |
496 | - if (!$i) $totalarray['nbfield']++; |
|
516 | + if (!$i) { |
|
517 | + $totalarray['nbfield']++; |
|
518 | + } |
|
497 | 519 | } |
498 | 520 | |
499 | 521 | // code |
@@ -502,7 +524,9 @@ discard block |
||
502 | 524 | print $obj->code." ".$obj->name; |
503 | 525 | print "</td>\n"; |
504 | 526 | |
505 | - if (! $i) $totalarray['nbfield']++; |
|
527 | + if (! $i) { |
|
528 | + $totalarray['nbfield']++; |
|
529 | + } |
|
506 | 530 | } |
507 | 531 | |
508 | 532 | // rate |
@@ -510,7 +534,9 @@ discard block |
||
510 | 534 | print '<td class="tdoverflowmax200">'; |
511 | 535 | print $obj->rate; |
512 | 536 | print "</td>\n"; |
513 | - if (! $i) $totalarray['nbfield']++; |
|
537 | + if (! $i) { |
|
538 | + $totalarray['nbfield']++; |
|
539 | + } |
|
514 | 540 | } |
515 | 541 | |
516 | 542 |