@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (dol_is_file($filetpl)) { |
| 155 | 155 | if ($backupold) { |
| 156 | 156 | $result = archiveOrBackupFile($filetpl); |
| 157 | - if (! $result) { |
|
| 157 | + if (!$result) { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | } else { |
@@ -344,48 +344,48 @@ discard block |
||
| 344 | 344 | if ($objectpage->type_container == 'setup') { |
| 345 | 345 | $content = '<div id="websitetemplateconfigpage">'."\n"; |
| 346 | 346 | $content .= '<?php'."\n"; |
| 347 | - $content .= '/*' . "\n"; |
|
| 348 | - $content .= ' * Actions' . "\n"; |
|
| 349 | - $content .= ' */' . "\n"; |
|
| 350 | - $content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');' . "\n"; |
|
| 351 | - $content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';' . "\n"; |
|
| 352 | - $content .= '' . "\n"; |
|
| 353 | - $content .= '/*' . "\n"; |
|
| 354 | - $content .= ' * View' . "\n"; |
|
| 355 | - $content .= ' */' . "\n"; |
|
| 356 | - $content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');' . "\n"; |
|
| 357 | - $content .= '' . "\n"; |
|
| 358 | - $content .= 'if (!empty($message)) {' . "\n"; |
|
| 359 | - $content .= ' print $message;' . "\n"; |
|
| 360 | - $content .= '}' . "\n"; |
|
| 361 | - $content .= '' . "\n"; |
|
| 362 | - $content .= 'if (!empty($formSetup->items)) {' . "\n"; |
|
| 363 | - $content .= ' $html = \'\';' . "\n"; |
|
| 364 | - $content .= '' . "\n"; |
|
| 365 | - $content .= ' $html .= \'<form action="config.php" method="POST">\';' . "\n"; |
|
| 366 | - $content .= ' // Generate hidden values from $formSetup->formHiddenInputs' . "\n"; |
|
| 367 | - $content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {' . "\n"; |
|
| 368 | - $content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {' . "\n"; |
|
| 369 | - $content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';' . "\n"; |
|
| 370 | - $content .= ' }' . "\n"; |
|
| 371 | - $content .= ' }' . "\n"; |
|
| 372 | - $content .= '' . "\n"; |
|
| 373 | - $content .= ' // Generate output table' . "\n"; |
|
| 374 | - $content .= ' $html .= $formSetup->generateTableOutput(true);' . "\n"; |
|
| 375 | - $content .= '' . "\n"; |
|
| 376 | - $content .= ' // Submit button' . "\n"; |
|
| 377 | - $content .= ' $html .= \'<input type="hidden" name="action" value="preview">\';' . "\n"; |
|
| 378 | - $content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';' . "\n"; |
|
| 379 | - $content .= ' $html .= \'<br>\';' . "\n"; |
|
| 380 | - $content .= ' $html .= \'<div class="form-setup-button-container center">\';' . "\n"; |
|
| 381 | - $content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';' . "\n"; |
|
| 382 | - $content .= ' $html .= \'</div>\';' . "\n"; |
|
| 383 | - $content .= ' $html .= \'</form>\';' . "\n"; |
|
| 384 | - $content .= '' . "\n"; |
|
| 385 | - $content .= ' print $html;' . "\n"; |
|
| 386 | - $content .= '}' . "\n"; |
|
| 387 | - $content .= '?>' . "\n"; |
|
| 388 | - $content .= '</div>' . "\n"; |
|
| 347 | + $content .= '/*'."\n"; |
|
| 348 | + $content .= ' * Actions'."\n"; |
|
| 349 | + $content .= ' */'."\n"; |
|
| 350 | + $content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');'."\n"; |
|
| 351 | + $content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';'."\n"; |
|
| 352 | + $content .= ''."\n"; |
|
| 353 | + $content .= '/*'."\n"; |
|
| 354 | + $content .= ' * View'."\n"; |
|
| 355 | + $content .= ' */'."\n"; |
|
| 356 | + $content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');'."\n"; |
|
| 357 | + $content .= ''."\n"; |
|
| 358 | + $content .= 'if (!empty($message)) {'."\n"; |
|
| 359 | + $content .= ' print $message;'."\n"; |
|
| 360 | + $content .= '}'."\n"; |
|
| 361 | + $content .= ''."\n"; |
|
| 362 | + $content .= 'if (!empty($formSetup->items)) {'."\n"; |
|
| 363 | + $content .= ' $html = \'\';'."\n"; |
|
| 364 | + $content .= ''."\n"; |
|
| 365 | + $content .= ' $html .= \'<form action="config.php" method="POST">\';'."\n"; |
|
| 366 | + $content .= ' // Generate hidden values from $formSetup->formHiddenInputs'."\n"; |
|
| 367 | + $content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {'."\n"; |
|
| 368 | + $content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {'."\n"; |
|
| 369 | + $content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';'."\n"; |
|
| 370 | + $content .= ' }'."\n"; |
|
| 371 | + $content .= ' }'."\n"; |
|
| 372 | + $content .= ''."\n"; |
|
| 373 | + $content .= ' // Generate output table'."\n"; |
|
| 374 | + $content .= ' $html .= $formSetup->generateTableOutput(true);'."\n"; |
|
| 375 | + $content .= ''."\n"; |
|
| 376 | + $content .= ' // Submit button'."\n"; |
|
| 377 | + $content .= ' $html .= \'<input type="hidden" name="action" value="preview">\';'."\n"; |
|
| 378 | + $content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';'."\n"; |
|
| 379 | + $content .= ' $html .= \'<br>\';'."\n"; |
|
| 380 | + $content .= ' $html .= \'<div class="form-setup-button-container center">\';'."\n"; |
|
| 381 | + $content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';'."\n"; |
|
| 382 | + $content .= ' $html .= \'</div>\';'."\n"; |
|
| 383 | + $content .= ' $html .= \'</form>\';'."\n"; |
|
| 384 | + $content .= ''."\n"; |
|
| 385 | + $content .= ' print $html;'."\n"; |
|
| 386 | + $content .= '}'."\n"; |
|
| 387 | + $content .= '?>'."\n"; |
|
| 388 | + $content .= '</div>'."\n"; |
|
| 389 | 389 | $tplcontent .= $content."\n"; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | $tplcontent .= '<?php // BEGIN PHP'."\n"; |
| 397 | 397 | $tplcontent .= '} catch(Exception $e) { print $e->getMessage(); }'."\n"; |
| 398 | - $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? |
|
| 398 | + $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? |
|
| 399 | 399 | |
| 400 | 400 | $tplcontent .= "// Now fix the content for SEO or multilanguage\n"; |
| 401 | 401 | // Old method for custom SEO |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; |
| 527 | 527 | $indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n"; |
| 528 | 528 | $indexcontent .= "}\n"; |
| 529 | - $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
| 529 | + $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
| 530 | 530 | $indexcontent .= '// END PHP ?>'."\n"; |
| 531 | 531 | $result = file_put_contents($fileindexsub, $indexcontent); |
| 532 | 532 | if ($result === false) { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | dol_delete_file($dest.'.zip'); |
| 786 | 786 | |
| 787 | 787 | // Compress it |
| 788 | - global $errormsg; // Used by dol_compress_dir |
|
| 788 | + global $errormsg; // Used by dol_compress_dir |
|
| 789 | 789 | $errormsg = ''; |
| 790 | 790 | $result = dol_compress_dir($src, $dest.'.zip', 'zip'); |
| 791 | 791 | if ($result < 0) { |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once")); |
| 967 | 967 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_EXEC')) { // If option is not on, we disallow functions to execute commands |
| 968 | 968 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen")); |
| 969 | - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
| 969 | + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
| 970 | 970 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities |
| 971 | 971 | } |
| 972 | 972 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) { // If option is not on, we disallow functions to write files |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | } |
| 976 | 976 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include")); |
| 977 | 977 | |
| 978 | - $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 978 | + $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 979 | 979 | |
| 980 | 980 | foreach ($forbiddenphpstrings as $forbiddenphpstring) { |
| 981 | 981 | if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ims', $phpfullcodestring)) { |
@@ -109,6 +109,6 @@ |
||
| 109 | 109 | dol_print_error($db); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $response =json_encode($response); |
|
| 112 | + $response = json_encode($response); |
|
| 113 | 113 | echo $response; |
| 114 | 114 | } |
@@ -113,6 +113,6 @@ |
||
| 113 | 113 | $response[] = array('id' => $categ['id'], 'label' => $categ['label'], 'fulllabel' => $categ['fulllabel'], 'htmlforoption' => dolPrintHTML($categ['fulllabel']), 'htmlforattribute' => dolPrintHTMLForAttribute($categ['data-html']), 'color' => $categ['color']); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $response =json_encode($response); |
|
| 116 | + $response = json_encode($response); |
|
| 117 | 117 | echo $response; |
| 118 | 118 | } |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * \brief File of class with all html predefined components for WebPortal |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 30 | -require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; |
|
| 31 | -require_once DOL_DOCUMENT_ROOT . '/webportal/class/html.formwebportal.class.php'; |
|
| 29 | +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 30 | +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
|
| 31 | +require_once DOL_DOCUMENT_ROOT.'/webportal/class/html.formwebportal.class.php'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Class to manage generation of HTML components |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // load module libraries |
| 137 | - dol_include_once('/webportal/class/webportal' . $elementEn . '.class.php'); |
|
| 137 | + dol_include_once('/webportal/class/webportal'.$elementEn.'.class.php'); |
|
| 138 | 138 | |
| 139 | 139 | // Initialize a technical objects |
| 140 | - $objectclass = 'WebPortal' . ucfirst($elementEn); |
|
| 140 | + $objectclass = 'WebPortal'.ucfirst($elementEn); |
|
| 141 | 141 | $object = new $objectclass($this->db); |
| 142 | 142 | |
| 143 | 143 | // set form list |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $this->sortfield = GETPOST('sortfield', 'aZ09comma'); |
| 148 | 148 | $this->sortorder = GETPOST('sortorder', 'aZ09comma'); |
| 149 | 149 | $this->page = GETPOSTISSET('page') ? GETPOSTINT('page') : 1; |
| 150 | - $this->titleKey = $objectclass . 'ListTitle'; |
|
| 150 | + $this->titleKey = $objectclass.'ListTitle'; |
|
| 151 | 151 | |
| 152 | 152 | // Initialize array of search criteria |
| 153 | 153 | //$search_all = GETPOST('search_all', 'alphanohtml'); |
| 154 | 154 | $search = array(); |
| 155 | 155 | foreach ($object->fields as $key => $val) { |
| 156 | - if (GETPOST('search_' . $key, 'alpha') !== '') { |
|
| 157 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
| 156 | + if (GETPOST('search_'.$key, 'alpha') !== '') { |
|
| 157 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
| 158 | 158 | } |
| 159 | 159 | if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
| 160 | 160 | /* Fix: this is not compatible with multilangage date format, replaced with dolibarr method |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | $search[$key . '_dtend'] = dol_mktime(23, 59, 59, $dateEndMonth, $dateEndDay, $dateEndYear); |
| 177 | 177 | } |
| 178 | 178 | */ |
| 179 | - $search[$key . '_dtstartmonth'] = GETPOSTINT('search_' . $key . '_dtstartmonth'); |
|
| 180 | - $search[$key . '_dtstartday'] = GETPOSTINT('search_' . $key . '_dtstartday'); |
|
| 181 | - $search[$key . '_dtstartyear'] = GETPOSTINT('search_' . $key . '_dtstartyear'); |
|
| 182 | - $search[$key . '_dtendmonth'] = GETPOSTINT('search_' . $key . '_dtendmonth'); |
|
| 183 | - $search[$key . '_dtendday'] = GETPOSTINT('search_' . $key . '_dtendday'); |
|
| 184 | - $search[$key . '_dtendyear'] = GETPOSTINT('search_' . $key . '_dtendyear'); |
|
| 179 | + $search[$key.'_dtstartmonth'] = GETPOSTINT('search_'.$key.'_dtstartmonth'); |
|
| 180 | + $search[$key.'_dtstartday'] = GETPOSTINT('search_'.$key.'_dtstartday'); |
|
| 181 | + $search[$key.'_dtstartyear'] = GETPOSTINT('search_'.$key.'_dtstartyear'); |
|
| 182 | + $search[$key.'_dtendmonth'] = GETPOSTINT('search_'.$key.'_dtendmonth'); |
|
| 183 | + $search[$key.'_dtendday'] = GETPOSTINT('search_'.$key.'_dtendday'); |
|
| 184 | + $search[$key.'_dtendyear'] = GETPOSTINT('search_'.$key.'_dtendyear'); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | $this->search = $search; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | // If $val['visible']==0, then we never show the field |
| 196 | 196 | if (!empty($val['visible'])) { |
| 197 | 197 | $visible = (int) dol_eval((string) $val['visible'], 1); |
| 198 | - $arrayfields['t.' . $key] = array( |
|
| 198 | + $arrayfields['t.'.$key] = array( |
|
| 199 | 199 | 'label' => $val['label'], |
| 200 | 200 | 'checked' => (($visible < 0) ? 0 : 1), |
| 201 | 201 | 'enabled' => (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
| 236 | 236 | //$search[$key . '_dtstart'] = ''; |
| 237 | 237 | //$search[$key . '_dtend'] = ''; |
| 238 | - $search[$key . '_dtstartmonth'] = ''; |
|
| 239 | - $search[$key . '_dtendmonth'] = ''; |
|
| 240 | - $search[$key . '_dtstartday'] = ''; |
|
| 241 | - $search[$key . '_dtendday'] = ''; |
|
| 242 | - $search[$key . '_dtstartyear'] = ''; |
|
| 243 | - $search[$key . '_dtendyear'] = ''; |
|
| 238 | + $search[$key.'_dtstartmonth'] = ''; |
|
| 239 | + $search[$key.'_dtendmonth'] = ''; |
|
| 240 | + $search[$key.'_dtstartday'] = ''; |
|
| 241 | + $search[$key.'_dtendday'] = ''; |
|
| 242 | + $search[$key.'_dtstartyear'] = ''; |
|
| 243 | + $search[$key.'_dtendyear'] = ''; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | $this->search = $search; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $offset = $limit * ($page - 1); |
| 297 | 297 | if (!$sortfield) { |
| 298 | 298 | reset($object->fields); // Reset is required to avoid key() to return null. |
| 299 | - $sortfield = 't.' . key($object->fields); // Set here default search field. By default 1st field in definition. |
|
| 299 | + $sortfield = 't.'.key($object->fields); // Set here default search field. By default 1st field in definition. |
|
| 300 | 300 | } |
| 301 | 301 | if (!$sortorder) { |
| 302 | 302 | $sortorder = 'DESC'; |
@@ -317,18 +317,18 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $sqlfields = $sql; // $sql fields to remove for count total |
| 319 | 319 | |
| 320 | - $sql .= " FROM " . $this->db->prefix() . $object->table_element . " as t"; |
|
| 320 | + $sql .= " FROM ".$this->db->prefix().$object->table_element." as t"; |
|
| 321 | 321 | // Add table from hooks |
| 322 | 322 | $parameters = array(); |
| 323 | 323 | $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 324 | 324 | $sql .= $hookmanager->resPrint; |
| 325 | 325 | if ($object->ismultientitymanaged == 1) { |
| 326 | - $sql .= " WHERE t.entity IN (" . getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)) . ")"; |
|
| 326 | + $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")"; |
|
| 327 | 327 | } else { |
| 328 | 328 | $sql .= " WHERE 1 = 1"; |
| 329 | 329 | } |
| 330 | 330 | // filter on logged third-party |
| 331 | - $sql .= " AND t.fk_soc = " . ((int) $socid); |
|
| 331 | + $sql .= " AND t.fk_soc = ".((int) $socid); |
|
| 332 | 332 | // discard record with status draft |
| 333 | 333 | $sql .= " AND t.fk_statut <> 0"; |
| 334 | 334 | |
@@ -345,17 +345,17 @@ discard block |
||
| 345 | 345 | $mode_search = 2; |
| 346 | 346 | } |
| 347 | 347 | if ($search[$key] != '') { |
| 348 | - $sql .= natural_search("t." . $this->db->escape($key), $search[$key], (($key == 'status' || $key == 'fk_statut') ? ($search[$key] < 0 ? 1 : 2) : $mode_search)); |
|
| 348 | + $sql .= natural_search("t.".$this->db->escape($key), $search[$key], (($key == 'status' || $key == 'fk_statut') ? ($search[$key] < 0 ? 1 : 2) : $mode_search)); |
|
| 349 | 349 | } |
| 350 | 350 | } else { |
| 351 | 351 | if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { |
| 352 | 352 | $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); |
| 353 | 353 | if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { |
| 354 | 354 | if (preg_match('/_dtstart$/', $key)) { |
| 355 | - $sql .= " AND t." . $this->db->escape($columnName) . " >= '" . $this->db->idate((int) $search[$key]) . "'"; |
|
| 355 | + $sql .= " AND t.".$this->db->escape($columnName)." >= '".$this->db->idate((int) $search[$key])."'"; |
|
| 356 | 356 | } |
| 357 | 357 | if (preg_match('/_dtend$/', $key)) { |
| 358 | - $sql .= " AND t." . $this->db->escape($columnName) . " <= '" . $this->db->idate((int) $search[$key]) . "'"; |
|
| 358 | + $sql .= " AND t.".$this->db->escape($columnName)." <= '".$this->db->idate((int) $search[$key])."'"; |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $nbtotalofrecords = 0; |
| 374 | 374 | if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { |
| 375 | 375 | /* The fast and low memory method to get and count full list converts the sql into a sql count */ |
| 376 | - $sqlforcount = preg_replace('/^' . preg_quote($sqlfields, '/') . '/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); |
|
| 376 | + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); |
|
| 377 | 377 | $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); |
| 378 | 378 | $resql = $this->db->query($sqlforcount); |
| 379 | 379 | if ($resql) { |
@@ -426,21 +426,21 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $param = ''; |
| 429 | - $param .= '&contextpage=' . urlencode($contextpage); |
|
| 430 | - $param .= '&limit=' . $limit; |
|
| 429 | + $param .= '&contextpage='.urlencode($contextpage); |
|
| 430 | + $param .= '&limit='.$limit; |
|
| 431 | 431 | foreach ($search as $key => $val) { |
| 432 | 432 | if (is_array($search[$key])) { |
| 433 | 433 | foreach ($search[$key] as $skey) { |
| 434 | 434 | if ($skey != '') { |
| 435 | - $param .= '&search_' . $key . '[]=' . urlencode($skey); |
|
| 435 | + $param .= '&search_'.$key.'[]='.urlencode($skey); |
|
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { |
| 439 | - $param .= '&search_' . $key . 'month=' . (GETPOSTINT('search_' . $key . 'month')); |
|
| 440 | - $param .= '&search_' . $key . 'day=' . (GETPOSTINT('search_' . $key . 'day')); |
|
| 441 | - $param .= '&search_' . $key . 'year=' . (GETPOSTINT('search_' . $key . 'year')); |
|
| 439 | + $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month')); |
|
| 440 | + $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day')); |
|
| 441 | + $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year')); |
|
| 442 | 442 | } elseif ($search[$key] != '') { |
| 443 | - $param .= '&search_' . $key . '=' . urlencode($search[$key]); |
|
| 443 | + $param .= '&search_'.$key.'='.urlencode($search[$key]); |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | // Add $param from hooks |
@@ -449,29 +449,29 @@ discard block |
||
| 449 | 449 | $param .= $hookmanager->resPrint; |
| 450 | 450 | |
| 451 | 451 | $url_file = $context->getControllerUrl($context->controller); |
| 452 | - $html .= '<form method="POST" id="searchFormList" action="' . $url_file . '">' . "\n"; |
|
| 452 | + $html .= '<form method="POST" id="searchFormList" action="'.$url_file.'">'."\n"; |
|
| 453 | 453 | $html .= $context->getFormToken(); |
| 454 | 454 | $html .= '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 455 | 455 | $html .= '<input type="hidden" name="action" value="list">'; |
| 456 | - $html .= '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
|
| 457 | - $html .= '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
|
| 458 | - $html .= '<input type="hidden" name="page" value="' . $page . '">'; |
|
| 459 | - $html .= '<input type="hidden" name="contextpage" value="' . $contextpage . '">'; |
|
| 456 | + $html .= '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
|
| 457 | + $html .= '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
|
| 458 | + $html .= '<input type="hidden" name="page" value="'.$page.'">'; |
|
| 459 | + $html .= '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; |
|
| 460 | 460 | |
| 461 | 461 | // pagination |
| 462 | - $pagination_param = $param . '&sortfield=' . $sortfield . '&sortorder=' . $sortorder; |
|
| 463 | - $html .= '<nav id="webportal-' . $elementEn . '-pagination">'; |
|
| 462 | + $pagination_param = $param.'&sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
| 463 | + $html .= '<nav id="webportal-'.$elementEn.'-pagination">'; |
|
| 464 | 464 | $html .= '<ul>'; |
| 465 | - $html .= '<li><strong>' . $langs->trans($titleKey) . '</strong> (' . $nbtotalofrecords . ')</li>'; |
|
| 465 | + $html .= '<li><strong>'.$langs->trans($titleKey).'</strong> ('.$nbtotalofrecords.')</li>'; |
|
| 466 | 466 | $html .= '</ul>'; |
| 467 | 467 | |
| 468 | 468 | /* Generate pagination list */ |
| 469 | - $html .= static::generatePageListNav($url_file . $pagination_param, $nbpages, $page); |
|
| 469 | + $html .= static::generatePageListNav($url_file.$pagination_param, $nbpages, $page); |
|
| 470 | 470 | |
| 471 | 471 | $html .= '</nav>'; |
| 472 | 472 | |
| 473 | 473 | // table with search filters and column titles |
| 474 | - $html .= '<table id="webportal-' . $elementEn . '-list" responsive="scroll" role="grid">'; |
|
| 474 | + $html .= '<table id="webportal-'.$elementEn.'-list" responsive="scroll" role="grid">'; |
|
| 475 | 475 | // title and desc for table |
| 476 | 476 | //if ($titleKey != '') { |
| 477 | 477 | // $html .= '<caption id="table-collapse-responsive">'; |
@@ -495,22 +495,22 @@ discard block |
||
| 495 | 495 | $html .= '</td>'; |
| 496 | 496 | // } |
| 497 | 497 | foreach ($object->fields as $key => $val) { |
| 498 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
| 499 | - $html .= '<td data-label="' . $arrayfields['t.' . $key]['label'] . '" data-col="'.dol_escape_htmltag($key).'" >'; |
|
| 498 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
| 499 | + $html .= '<td data-label="'.$arrayfields['t.'.$key]['label'].'" data-col="'.dol_escape_htmltag($key).'" >'; |
|
| 500 | 500 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
| 501 | - $html .= $this->form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', ''); |
|
| 501 | + $html .= $this->form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', ''); |
|
| 502 | 502 | } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
| 503 | - $postDateStart = dol_mktime(0, 0, 0, (int) $search[$key . '_dtstartmonth'], (int) $search[$key . '_dtstartday'], (int) $search[$key . '_dtstartyear']); |
|
| 504 | - $postDateEnd = dol_mktime(0, 0, 0, (int) $search[$key . '_dtendmonth'], (int) $search[$key . '_dtendday'], (int) $search[$key . '_dtendyear']); |
|
| 503 | + $postDateStart = dol_mktime(0, 0, 0, (int) $search[$key.'_dtstartmonth'], (int) $search[$key.'_dtstartday'], (int) $search[$key.'_dtstartyear']); |
|
| 504 | + $postDateEnd = dol_mktime(0, 0, 0, (int) $search[$key.'_dtendmonth'], (int) $search[$key.'_dtendday'], (int) $search[$key.'_dtendyear']); |
|
| 505 | 505 | |
| 506 | 506 | $html .= '<div class="grid width150">'; |
| 507 | - $html .= $this->form->inputDate('search_' . $key . '_dtstart', $postDateStart ? $postDateStart : '', $langs->trans('From')); |
|
| 507 | + $html .= $this->form->inputDate('search_'.$key.'_dtstart', $postDateStart ? $postDateStart : '', $langs->trans('From')); |
|
| 508 | 508 | $html .= '</div>'; |
| 509 | 509 | $html .= '<div class="grid width150">'; |
| 510 | - $html .= $this->form->inputDate('search_' . $key . '_dtend', $postDateEnd ? $postDateEnd : '', $langs->trans('to')); |
|
| 510 | + $html .= $this->form->inputDate('search_'.$key.'_dtend', $postDateEnd ? $postDateEnd : '', $langs->trans('to')); |
|
| 511 | 511 | $html .= '</div>'; |
| 512 | 512 | } else { |
| 513 | - $html .= '<input type="text" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">'; |
|
| 513 | + $html .= '<input type="text" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">'; |
|
| 514 | 514 | } |
| 515 | 515 | $html .= '</td>'; |
| 516 | 516 | } |
@@ -521,18 +521,18 @@ discard block |
||
| 521 | 521 | $html .= $hookmanager->resPrint; |
| 522 | 522 | // Remain to pay |
| 523 | 523 | if (array_key_exists('remain_to_pay', $arrayfields) && !empty($arrayfields['remain_to_pay']['checked'])) { |
| 524 | - $html .= '<td data-label="' . $arrayfields['remain_to_pay']['label'] . '">'; |
|
| 524 | + $html .= '<td data-label="'.$arrayfields['remain_to_pay']['label'].'">'; |
|
| 525 | 525 | $html .= '</td>'; |
| 526 | 526 | } |
| 527 | 527 | // Download link |
| 528 | 528 | if (array_key_exists('download_link', $arrayfields) && !empty($arrayfields['download_link']['checked'])) { |
| 529 | - $html .= '<td data-label="' . $arrayfields['download_link']['label'] . '">'; |
|
| 529 | + $html .= '<td data-label="'.$arrayfields['download_link']['label'].'">'; |
|
| 530 | 530 | $html .= '</td>'; |
| 531 | 531 | } |
| 532 | 532 | // Signature link |
| 533 | 533 | if ($elementEn == "propal" && getDolGlobalString("PROPOSAL_ALLOW_ONLINESIGN") != 0) { |
| 534 | 534 | if (array_key_exists('signature_link', $arrayfields) && !empty($arrayfields['signature_link']['checked'])) { |
| 535 | - $html .= '<td data-label="' . $arrayfields['signature_link']['label'] . '">'; |
|
| 535 | + $html .= '<td data-label="'.$arrayfields['signature_link']['label'].'">'; |
|
| 536 | 536 | $html .= '</td>'; |
| 537 | 537 | } |
| 538 | 538 | } |
@@ -550,16 +550,16 @@ discard block |
||
| 550 | 550 | $totalarray['nbfield']++; |
| 551 | 551 | // } |
| 552 | 552 | foreach ($object->fields as $key => $val) { |
| 553 | - $tableKey = 't.' . $key; |
|
| 553 | + $tableKey = 't.'.$key; |
|
| 554 | 554 | if (!empty($arrayfields[$tableKey]['checked'])) { |
| 555 | 555 | $tableOrder = ''; |
| 556 | 556 | if (array_key_exists($tableKey, $sortList)) { |
| 557 | 557 | $tableOrder = strtolower($sortList[$tableKey]); |
| 558 | 558 | } |
| 559 | - $url_param = $url_file . '&sortfield=' . $tableKey . '&sortorder=' . ($tableOrder == 'desc' ? 'asc' : 'desc') . $param; |
|
| 560 | - $html .= '<th data-col="'.dol_escape_htmltag($key).'" scope="col"' . ($tableOrder != '' ? ' table-order="' . $tableOrder . '"' : '') . '>'; |
|
| 561 | - $html .= '<a href="' . $url_param . '">'; |
|
| 562 | - $html .= $langs->trans($arrayfields['t.' . $key]['label']); |
|
| 559 | + $url_param = $url_file.'&sortfield='.$tableKey.'&sortorder='.($tableOrder == 'desc' ? 'asc' : 'desc').$param; |
|
| 560 | + $html .= '<th data-col="'.dol_escape_htmltag($key).'" scope="col"'.($tableOrder != '' ? ' table-order="'.$tableOrder.'"' : '').'>'; |
|
| 561 | + $html .= '<a href="'.$url_param.'">'; |
|
| 562 | + $html .= $langs->trans($arrayfields['t.'.$key]['label']); |
|
| 563 | 563 | $html .= '</a>'; |
| 564 | 564 | $html .= '</th>'; |
| 565 | 565 | $totalarray['nbfield']++; |
@@ -643,13 +643,13 @@ discard block |
||
| 643 | 643 | $remaintopay = 0; |
| 644 | 644 | } |
| 645 | 645 | if ($object->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1 && $discount) { |
| 646 | - $remaincreditnote = $discount->getAvailableDiscounts($companyStatic, null, 'rc.fk_facture_source=' . $object->id); |
|
| 646 | + $remaincreditnote = $discount->getAvailableDiscounts($companyStatic, null, 'rc.fk_facture_source='.$object->id); |
|
| 647 | 647 | $remaintopay = -$remaincreditnote; |
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | // Show line of result |
| 652 | - $html .= '<tr data-rowid="' . $object->id . '">'; |
|
| 652 | + $html .= '<tr data-rowid="'.$object->id.'">'; |
|
| 653 | 653 | // if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
| 654 | 654 | $html .= '<td class="nowraponall">'; |
| 655 | 655 | $html .= '</td>'; |
@@ -658,8 +658,8 @@ discard block |
||
| 658 | 658 | } |
| 659 | 659 | // } |
| 660 | 660 | foreach ($object->fields as $key => $val) { |
| 661 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
| 662 | - $html .= '<td class="nowraponall" data-label="' . $arrayfields['t.' . $key]['label'] . '">'; |
|
| 661 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
| 662 | + $html .= '<td class="nowraponall" data-label="'.$arrayfields['t.'.$key]['label'].'">'; |
|
| 663 | 663 | if ($key == 'status' || $key == 'fk_statut') { |
| 664 | 664 | if ($elementEn == 'invoice') { |
| 665 | 665 | // specific to get invoice status (depends on payment) |
@@ -680,22 +680,22 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | if (!empty($val['isameasure']) && $val['isameasure'] == 1) { |
| 682 | 682 | if (!$i) { |
| 683 | - $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key; |
|
| 683 | + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
| 684 | 684 | } |
| 685 | 685 | if (!isset($totalarray['val'])) { |
| 686 | 686 | $totalarray['val'] = array(); |
| 687 | 687 | } |
| 688 | - if (!isset($totalarray['val']['t.' . $key])) { |
|
| 689 | - $totalarray['val']['t.' . $key] = 0; |
|
| 688 | + if (!isset($totalarray['val']['t.'.$key])) { |
|
| 689 | + $totalarray['val']['t.'.$key] = 0; |
|
| 690 | 690 | } |
| 691 | - $totalarray['val']['t.' . $key] += $object->$key; |
|
| 691 | + $totalarray['val']['t.'.$key] += $object->$key; |
|
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | } |
| 695 | 695 | // Remain to pay |
| 696 | 696 | if (array_key_exists('remain_to_pay', $arrayfields) && !empty($arrayfields['remain_to_pay']['checked'])) { |
| 697 | 697 | // @phan-suppress-next-line PhanTypeInvalidDimOffset |
| 698 | - $html .= '<td class="nowraponall" data-label="' . dolPrintHTMLForAttribute((string) $arrayfields['remain_to_pay']['label']) . '">'; |
|
| 698 | + $html .= '<td class="nowraponall" data-label="'.dolPrintHTMLForAttribute((string) $arrayfields['remain_to_pay']['label']).'">'; |
|
| 699 | 699 | // @phan-suppress-next-line PhanTypeMismatchArgument PhanTypeInvalidDimOffset |
| 700 | 700 | $html .= $this->form->showOutputFieldForObject($object, $arrayfields['remain_to_pay'], 'remain_to_pay', $remaintopay, ''); |
| 701 | 701 | //$html .= price($remaintopay); |
@@ -707,9 +707,9 @@ discard block |
||
| 707 | 707 | // Download link |
| 708 | 708 | if (array_key_exists('download_link', $arrayfields) && !empty($arrayfields['download_link']['checked'])) { |
| 709 | 709 | $element = $object->element; |
| 710 | - $html .= '<td class="nowraponall" data-label="' . $arrayfields['download_link']['label'] . '">'; |
|
| 710 | + $html .= '<td class="nowraponall" data-label="'.$arrayfields['download_link']['label'].'">'; |
|
| 711 | 711 | $filename = dol_sanitizeFileName($obj->ref); |
| 712 | - $filedir = $conf->{$element}->multidir_output[$obj->element_entity] . '/' . dol_sanitizeFileName($obj->ref); |
|
| 712 | + $filedir = $conf->{$element}->multidir_output[$obj->element_entity].'/'.dol_sanitizeFileName($obj->ref); |
|
| 713 | 713 | $html .= $this->form->getDocumentsLink($element, $filename, $filedir); |
| 714 | 714 | $html .= '</td>'; |
| 715 | 715 | if (!$i) { |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | if ($elementEn == "propal" && getDolGlobalString("PROPOSAL_ALLOW_ONLINESIGN") != 0) { |
| 721 | 721 | '@phan-var-force Propal $object'; |
| 722 | 722 | if (!empty($arrayfields['signature_link']['checked'])) { |
| 723 | - $html .= '<td class="nowraponall" data-label="' . $arrayfields['signature_link']['label'] . '">'; |
|
| 723 | + $html .= '<td class="nowraponall" data-label="'.$arrayfields['signature_link']['label'].'">'; |
|
| 724 | 724 | if ($object->fk_statut == Propal::STATUS_VALIDATED) { |
| 725 | 725 | $html .= $this->form->getSignatureLink('proposal', $object); |
| 726 | 726 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $html .= '</td>'; |
| 760 | 760 | } else { |
| 761 | 761 | if ($i == 1) { |
| 762 | - $html .= '<td>' . $langs->trans("Total") . '</td>'; |
|
| 762 | + $html .= '<td>'.$langs->trans("Total").'</td>'; |
|
| 763 | 763 | } else { |
| 764 | 764 | $html .= '<td></td>'; |
| 765 | 765 | } |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | $colspan++; |
| 777 | 777 | } |
| 778 | 778 | } |
| 779 | - $html .= '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>'; |
|
| 779 | + $html .= '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>'; |
|
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | $html .= '</tbody>'; |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | $html = '<ul class="pages-nav-list">'; |
| 817 | 817 | |
| 818 | 818 | if ($currentPage > 1) { |
| 819 | - $html .= '<li><a class="pages-nav-list__icon --prev" aria-label="' . dol_escape_htmltag($langs->trans('AriaPrevPage')) . '" href="' . $url . $pSep . 'page=' . ($currentPage - 1) . '" ' . ($currentPage <= 1 ? ' disabled' : '') . '></a></li>'; |
|
| 819 | + $html .= '<li><a class="pages-nav-list__icon --prev" aria-label="'.dol_escape_htmltag($langs->trans('AriaPrevPage')).'" href="'.$url.$pSep.'page='.($currentPage - 1).'" '.($currentPage <= 1 ? ' disabled' : '').'></a></li>'; |
|
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | $maxPaginItem = min($nbPages, 5); |
@@ -824,21 +824,21 @@ discard block |
||
| 824 | 824 | $maxPageNum = min($nbPages, $currentPage + 3); |
| 825 | 825 | |
| 826 | 826 | if ($minPageNum > 1) { |
| 827 | - $html .= '<li><a class="pages-nav-list__link ' . ($currentPage == 1 ? '--active' : '') . '" aria-label="' . dol_escape_htmltag($langs->trans('AriaPageX', 1)) . '" href="' . $url . $pSep . 'page=1" >1</a></li>'; |
|
| 827 | + $html .= '<li><a class="pages-nav-list__link '.($currentPage == 1 ? '--active' : '').'" aria-label="'.dol_escape_htmltag($langs->trans('AriaPageX', 1)).'" href="'.$url.$pSep.'page=1" >1</a></li>'; |
|
| 828 | 828 | $html .= '<li>…</li>'; |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | for ($p = $minPageNum; $p <= $maxPageNum; $p++) { |
| 832 | - $html .= '<li><a class="pages-nav-list__link ' . ($currentPage === $p ? '--active' : '') . '" aria-label="' . dol_escape_htmltag($langs->trans('AriaPageX', $p)) . '" href="' . $url . $pSep . 'page=' . $p . '">' . $p . '</a></li>'; |
|
| 832 | + $html .= '<li><a class="pages-nav-list__link '.($currentPage === $p ? '--active' : '').'" aria-label="'.dol_escape_htmltag($langs->trans('AriaPageX', $p)).'" href="'.$url.$pSep.'page='.$p.'">'.$p.'</a></li>'; |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | if ($maxPaginItem < $nbPages) { |
| 836 | 836 | $html .= '<li>…</li>'; |
| 837 | - $html .= '<li><a class="pages-nav-list__link ' . ($currentPage == $nbPages ? '--active' : '') . '" aria-label="' . dol_escape_htmltag($langs->trans('AriaPageX', $nbPages)) . '" href="' . $url . $pSep . 'page=' . $nbPages . '">' . $nbPages . '</a></li>'; |
|
| 837 | + $html .= '<li><a class="pages-nav-list__link '.($currentPage == $nbPages ? '--active' : '').'" aria-label="'.dol_escape_htmltag($langs->trans('AriaPageX', $nbPages)).'" href="'.$url.$pSep.'page='.$nbPages.'">'.$nbPages.'</a></li>'; |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | if ($currentPage < $nbPages) { |
| 841 | - $html .= '<li><a class="pages-nav-list__icon --next" aria-label="' . dol_escape_htmltag($langs->trans('AriaNextPage')) . '" href="' . $url . $pSep . 'page=' . ($currentPage + 1) . '" ' . ($currentPage >= $nbPages ? ' disabled' : '') . '></a></li>'; |
|
| 841 | + $html .= '<li><a class="pages-nav-list__icon --next" aria-label="'.dol_escape_htmltag($langs->trans('AriaNextPage')).'" href="'.$url.$pSep.'page='.($currentPage + 1).'" '.($currentPage >= $nbPages ? ' disabled' : '').'></a></li>'; |
|
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | $html .= '</ul>'; |