@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | class Odf |
| 32 | 32 | { |
| 33 | 33 | protected $config = array( |
| 34 | - 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy |
|
| 34 | + 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy |
|
| 35 | 35 | 'DELIMITER_LEFT' => '{', |
| 36 | 36 | 'DELIMITER_RIGHT' => '}', |
| 37 | 37 | 'PATH_TO_TMP' => '/tmp' |
| 38 | 38 | ); |
| 39 | 39 | protected $file; |
| 40 | - protected $contentXml; // To store content of content.xml file |
|
| 41 | - protected $metaXml; // To store content of meta.xml file |
|
| 42 | - protected $stylesXml; // To store content of styles.xml file |
|
| 43 | - protected $manifestXml; // To store content of META-INF/manifest.xml file |
|
| 40 | + protected $contentXml; // To store content of content.xml file |
|
| 41 | + protected $metaXml; // To store content of meta.xml file |
|
| 42 | + protected $stylesXml; // To store content of styles.xml file |
|
| 43 | + protected $manifestXml; // To store content of META-INF/manifest.xml file |
|
| 44 | 44 | protected $tmpfile; |
| 45 | - protected $tmpdir=''; |
|
| 45 | + protected $tmpdir = ''; |
|
| 46 | 46 | protected $images = array(); |
| 47 | 47 | protected $vars = array(); |
| 48 | 48 | protected $segments = array(); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public $creator; |
| 51 | 51 | public $title; |
| 52 | 52 | public $subject; |
| 53 | - public $userdefined=array(); |
|
| 53 | + public $userdefined = array(); |
|
| 54 | 54 | |
| 55 | 55 | const PIXEL_TO_CM = 0.026458333; |
| 56 | 56 | const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s'; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | clearstatcache(); |
| 70 | 70 | |
| 71 | - if (! is_array($config)) { |
|
| 71 | + if (!is_array($config)) { |
|
| 72 | 72 | throw new OdfException('Configuration data must be provided as array'); |
| 73 | 73 | } |
| 74 | 74 | foreach ($config as $configKey => $configValue) { |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $md5uniqid = md5(uniqid()); |
| 81 | - if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
| 82 | - $this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid; |
|
| 83 | - $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
|
| 81 | + if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
| 82 | + $this->tmpdir .= ($this->tmpdir ? '/' : '').$md5uniqid; |
|
| 83 | + $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
|
| 84 | 84 | |
| 85 | 85 | // A working directory is required for some zip proxy like PclZipProxy |
| 86 | - if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && ! is_dir($this->config['PATH_TO_TMP'])) { |
|
| 86 | + if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && !is_dir($this->config['PATH_TO_TMP'])) { |
|
| 87 | 87 | throw new OdfException('Temporary directory '.$this->config['PATH_TO_TMP'].' must exists'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | $zipHandler = $this->config['ZIP_PROXY']; |
| 97 | 97 | if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
| 98 | 98 | include_once 'zip/'.$zipHandler.'.php'; |
| 99 | - if (! class_exists($this->config['ZIP_PROXY'])) { |
|
| 100 | - throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings'); |
|
| 99 | + if (!class_exists($this->config['ZIP_PROXY'])) { |
|
| 100 | + throw new OdfException($this->config['ZIP_PROXY'].' class not found - check your php settings'); |
|
| 101 | 101 | } |
| 102 | 102 | $this->file = new $zipHandler($this->tmpdir); |
| 103 | 103 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function setVars($key, $value, $encode = true, $charset = 'ISO-8859') |
| 146 | 146 | { |
| 147 | - $tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']; |
|
| 147 | + $tag = $this->config['DELIMITER_LEFT'].$key.$this->config['DELIMITER_RIGHT']; |
|
| 148 | 148 | |
| 149 | 149 | // TODO Warning string may be: |
| 150 | 150 | // <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span> |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | // Check if the value includes html tags |
| 181 | 181 | if ($this->_hasHtmlTag($value) === true) { |
| 182 | - $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter |
|
| 182 | + $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter |
|
| 183 | 183 | |
| 184 | 184 | // Default styles for strong/b, i/em, u, s, sub & sup |
| 185 | 185 | $automaticStyles = array( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $convertedValue = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations, $encode, $charset); |
| 198 | 198 | |
| 199 | 199 | foreach ($customStyles as $key => $val) { |
| 200 | - array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>'); |
|
| 200 | + array_push($automaticStyles, '<style:style style:name="customStyle'.$key.'" style:family="text">'.$val.'</style:style>'); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Join the styles and add them to the content xml |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | $styles .= $style; |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | - $this->contentXml = str_replace('</office:automatic-styles>', $styles . '</office:automatic-styles>', $this->contentXml); |
|
| 210 | + $this->contentXml = str_replace('</office:automatic-styles>', $styles.'</office:automatic-styles>', $this->contentXml); |
|
| 211 | 211 | |
| 212 | 212 | // Join the font declarations and add them to the content xml |
| 213 | 213 | $fonts = ''; |
| 214 | 214 | foreach ($fontDeclarations as $font) { |
| 215 | - if (strpos($this->contentXml, 'style:name="' . $font . '"') === false) { |
|
| 216 | - $fonts .= '<style:font-face style:name="' . $font . '" svg:font-family="\'' . $font . '\'" />'; |
|
| 215 | + if (strpos($this->contentXml, 'style:name="'.$font.'"') === false) { |
|
| 216 | + $fonts .= '<style:font-face style:name="'.$font.'" svg:font-family="\''.$font.'\'" />'; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | - $this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml); |
|
| 219 | + $this->contentXml = str_replace('</office:font-face-decls>', $fonts.'</office:font-face-decls>', $this->contentXml); |
|
| 220 | 220 | } else { |
| 221 | 221 | $convertedValue = $this->encode_chars($convertedValue, $encode, $charset); |
| 222 | 222 | $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $convertedValue); |
@@ -253,23 +253,23 @@ discard block |
||
| 253 | 253 | break; |
| 254 | 254 | case 'strong': |
| 255 | 255 | case 'b': |
| 256 | - $odtResult .= '<text:span text:style-name="boldText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 256 | + $odtResult .= '<text:span text:style-name="boldText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 257 | 257 | break; |
| 258 | 258 | case 'i': |
| 259 | 259 | case 'em': |
| 260 | - $odtResult .= '<text:span text:style-name="italicText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 260 | + $odtResult .= '<text:span text:style-name="italicText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 261 | 261 | break; |
| 262 | 262 | case 'u': |
| 263 | - $odtResult .= '<text:span text:style-name="underlineText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 263 | + $odtResult .= '<text:span text:style-name="underlineText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 264 | 264 | break; |
| 265 | 265 | case 's': |
| 266 | - $odtResult .= '<text:span text:style-name="strikethroughText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 266 | + $odtResult .= '<text:span text:style-name="strikethroughText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 267 | 267 | break; |
| 268 | 268 | case 'sub': |
| 269 | - $odtResult .= '<text:span text:style-name="subText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 269 | + $odtResult .= '<text:span text:style-name="subText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 270 | 270 | break; |
| 271 | 271 | case 'sup': |
| 272 | - $odtResult .= '<text:span text:style-name="supText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 272 | + $odtResult .= '<text:span text:style-name="supText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 273 | 273 | break; |
| 274 | 274 | case 'span': |
| 275 | 275 | if (isset($tag['attributes']['style'])) { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | if (!in_array($fontName, $fontDeclarations)) { |
| 285 | 285 | array_push($fontDeclarations, $fontName); |
| 286 | 286 | } |
| 287 | - $odtStyles .= '<style:text-properties style:font-name="' . $fontName . '" />'; |
|
| 287 | + $odtStyles .= '<style:text-properties style:font-name="'.$fontName.'" />'; |
|
| 288 | 288 | break; |
| 289 | 289 | case 'font-size': |
| 290 | 290 | if (preg_match('/([0-9]+)\s?(px|pt)/', $styleValue, $matches)) { |
@@ -292,21 +292,21 @@ discard block |
||
| 292 | 292 | if ($matches[2] == 'px') { |
| 293 | 293 | $fontSize = round($fontSize * 0.75); |
| 294 | 294 | } |
| 295 | - $odtStyles .= '<style:text-properties fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt" />'; |
|
| 295 | + $odtStyles .= '<style:text-properties fo:font-size="'.$fontSize.'pt" style:font-size-asian="'.$fontSize.'pt" style:font-size-complex="'.$fontSize.'pt" />'; |
|
| 296 | 296 | } |
| 297 | 297 | break; |
| 298 | 298 | case 'color': |
| 299 | 299 | if (preg_match('/#[0-9A-Fa-f]{3}(?:[0-9A-Fa-f]{3})?/', $styleValue)) { |
| 300 | - $odtStyles .= '<style:text-properties fo:color="' . $styleValue . '" />'; |
|
| 300 | + $odtStyles .= '<style:text-properties fo:color="'.$styleValue.'" />'; |
|
| 301 | 301 | } |
| 302 | 302 | break; |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | if (strlen($odtStyles) > 0) { |
| 306 | 306 | // Generate a unique id for the style (using microtime and random because some CPUs are really fast...) |
| 307 | - $key = str_replace('.', '', (string) microtime(true)) . uniqid(mt_rand()); |
|
| 307 | + $key = str_replace('.', '', (string) microtime(true)).uniqid(mt_rand()); |
|
| 308 | 308 | $customStyles[$key] = $odtStyles; |
| 309 | - $odtResult .= '<text:span text:style-name="customStyle' . $key . '">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 309 | + $odtResult .= '<text:span text:style-name="customStyle'.$key.'">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | break; |
@@ -443,24 +443,24 @@ discard block |
||
| 443 | 443 | public function htmlToUTFAndPreOdf($value) |
| 444 | 444 | { |
| 445 | 445 | // We decode into utf8, entities |
| 446 | - $value=dol_html_entity_decode($value, ENT_QUOTES|ENT_HTML5); |
|
| 446 | + $value = dol_html_entity_decode($value, ENT_QUOTES | ENT_HTML5); |
|
| 447 | 447 | |
| 448 | 448 | // We convert html tags |
| 449 | - $ishtml=dol_textishtml($value); |
|
| 449 | + $ishtml = dol_textishtml($value); |
|
| 450 | 450 | if ($ishtml) { |
| 451 | 451 | // If string is "MYPODUCT - Desc <strong>bold</strong> with é accent<br />\n<br />\nUn texto en español ?" |
| 452 | 452 | // Result after clean must be "MYPODUCT - Desc bold with é accent\n\nUn texto en español ?" |
| 453 | 453 | |
| 454 | 454 | // We want to ignore \n and we want all <br> to be \n |
| 455 | - $value=preg_replace('/(\r\n|\r|\n)/i', '', $value); |
|
| 456 | - $value=preg_replace('/<br>/i', "\n", $value); |
|
| 457 | - $value=preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value); |
|
| 458 | - $value=preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value); |
|
| 455 | + $value = preg_replace('/(\r\n|\r|\n)/i', '', $value); |
|
| 456 | + $value = preg_replace('/<br>/i', "\n", $value); |
|
| 457 | + $value = preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value); |
|
| 458 | + $value = preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value); |
|
| 459 | 459 | |
| 460 | 460 | //$value=preg_replace('/<strong>/','__lt__text:p text:style-name=__quot__bold__quot____gt__',$value); |
| 461 | 461 | //$value=preg_replace('/<\/strong>/','__lt__/text:p__gt__',$value); |
| 462 | 462 | |
| 463 | - $value=dol_string_nohtmltag($value, 0); |
|
| 463 | + $value = dol_string_nohtmltag($value, 0); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | return $value; |
@@ -536,10 +536,10 @@ discard block |
||
| 536 | 536 | $balise = str_replace('row.', '', $matches2[1]); |
| 537 | 537 | // Move segment tags around the row |
| 538 | 538 | $replace = array( |
| 539 | - '[!-- BEGIN ' . $matches2[1] . ' --]' => '', |
|
| 540 | - '[!-- END ' . $matches2[1] . ' --]' => '', |
|
| 541 | - '<table:table-row' => '[!-- BEGIN ' . $balise . ' --]<table:table-row', |
|
| 542 | - '</table:table-row>' => '</table:table-row>[!-- END ' . $balise . ' --]' |
|
| 539 | + '[!-- BEGIN '.$matches2[1].' --]' => '', |
|
| 540 | + '[!-- END '.$matches2[1].' --]' => '', |
|
| 541 | + '<table:table-row' => '[!-- BEGIN '.$balise.' --]<table:table-row', |
|
| 542 | + '</table:table-row>' => '</table:table-row>[!-- END '.$balise.' --]' |
|
| 543 | 543 | ); |
| 544 | 544 | $replacedXML = str_replace(array_keys($replace), array_values($replace), $matches[0][$i]); |
| 545 | 545 | $this->contentXml = str_replace($matches[0][$i], $replacedXML, $this->contentXml); |
@@ -562,14 +562,14 @@ discard block |
||
| 562 | 562 | else return; |
| 563 | 563 | |
| 564 | 564 | // Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined |
| 565 | - $reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
| 565 | + $reg = '@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
| 566 | 566 | $matches = array(); |
| 567 | 567 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
| 568 | 568 | |
| 569 | 569 | //var_dump($this->vars);exit; |
| 570 | 570 | foreach ($matches as $match) { // For each match, if there is no entry into this->vars, we add it |
| 571 | - if (! empty($match[1]) && ! isset($this->vars[$match[1]])) { |
|
| 572 | - $this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
| 571 | + if (!empty($match[1]) && !isset($this->vars[$match[1]])) { |
|
| 572 | + $this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | //var_dump($this->vars);exit; |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | // Remove the IF tag |
| 585 | 585 | $xml = str_replace('[!-- IF '.$key.' --]', '', $xml); |
| 586 | 586 | // Remove everything between the ELSE tag (if it exists) and the ENDIF tag |
| 587 | - $reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 587 | + $reg = '@(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 588 | 588 | $xml = preg_replace($reg, '', $xml); |
| 589 | 589 | /*if ($sav != $xml) |
| 590 | 590 | { |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | //dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF "); |
| 598 | 598 | //$sav=$xml; |
| 599 | 599 | // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF |
| 600 | - $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 600 | + $reg = '@\[!--\sIF\s'.preg_quote($key, '@').'\s--\](.*)(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 601 | 601 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
| 602 | 602 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
| 603 | 603 | if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml); |
@@ -625,12 +625,12 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function mergeSegment(Segment $segment) |
| 627 | 627 | { |
| 628 | - if (! array_key_exists($segment->getName(), $this->segments)) { |
|
| 629 | - throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?'); |
|
| 628 | + if (!array_key_exists($segment->getName(), $this->segments)) { |
|
| 629 | + throw new OdfException($segment->getName().'cannot be parsed, has it been set yet ?'); |
|
| 630 | 630 | } |
| 631 | 631 | $string = $segment->getName(); |
| 632 | 632 | // $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU'; |
| 633 | - $reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU'; |
|
| 633 | + $reg = '@\[!--\sBEGIN\s'.$string.'\s--\](.*)\[!--.+END\s'.$string.'\s--\]@smU'; |
|
| 634 | 634 | $this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml); |
| 635 | 635 | return $this; |
| 636 | 636 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | public function printVars() |
| 644 | 644 | { |
| 645 | - return print_r('<pre>' . print_r($this->vars, true) . '</pre>', true); |
|
| 645 | + return print_r('<pre>'.print_r($this->vars, true).'</pre>', true); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | public function printDeclaredSegments() |
| 665 | 665 | { |
| 666 | - return '<pre>' . print_r(implode(' ', array_keys($this->segments)), true) . '</pre>'; |
|
| 666 | + return '<pre>'.print_r(implode(' ', array_keys($this->segments)), true).'</pre>'; |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | { |
| 700 | 700 | if ($file !== null && is_string($file)) { |
| 701 | 701 | if (file_exists($file) && !(is_file($file) && is_writable($file))) { |
| 702 | - throw new OdfException('Permission denied : can\'t create ' . $file); |
|
| 702 | + throw new OdfException('Permission denied : can\'t create '.$file); |
|
| 703 | 703 | } |
| 704 | 704 | $this->_save(); |
| 705 | 705 | copy($this->tmpfile, $file); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | */ |
| 717 | 717 | private function _save() |
| 718 | 718 | { |
| 719 | - $res=$this->file->open($this->tmpfile); // tmpfile is odt template |
|
| 719 | + $res = $this->file->open($this->tmpfile); // tmpfile is odt template |
|
| 720 | 720 | $this->_parse('content'); |
| 721 | 721 | $this->_parse('styles'); |
| 722 | 722 | $this->_parse('meta'); |
@@ -724,23 +724,23 @@ discard block |
||
| 724 | 724 | $this->setMetaData(); |
| 725 | 725 | //print $this->metaXml;exit; |
| 726 | 726 | |
| 727 | - if (! $this->file->addFromString('content.xml', $this->contentXml)) { |
|
| 727 | + if (!$this->file->addFromString('content.xml', $this->contentXml)) { |
|
| 728 | 728 | throw new OdfException('Error during file export addFromString content'); |
| 729 | 729 | } |
| 730 | - if (! $this->file->addFromString('meta.xml', $this->metaXml)) { |
|
| 730 | + if (!$this->file->addFromString('meta.xml', $this->metaXml)) { |
|
| 731 | 731 | throw new OdfException('Error during file export addFromString meta'); |
| 732 | 732 | } |
| 733 | - if (! $this->file->addFromString('styles.xml', $this->stylesXml)) { |
|
| 733 | + if (!$this->file->addFromString('styles.xml', $this->stylesXml)) { |
|
| 734 | 734 | throw new OdfException('Error during file export addFromString styles'); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | foreach ($this->images as $imageKey => $imageValue) { |
| 738 | 738 | // Add the image inside the ODT document |
| 739 | - $this->file->addFile($imageKey, 'Pictures/' . $imageValue); |
|
| 739 | + $this->file->addFile($imageKey, 'Pictures/'.$imageValue); |
|
| 740 | 740 | // Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice) |
| 741 | 741 | $this->addImageToManifest($imageValue); |
| 742 | 742 | } |
| 743 | - if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { |
|
| 743 | + if (!$this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { |
|
| 744 | 744 | throw new OdfException('Error during file export: manifest.xml'); |
| 745 | 745 | } |
| 746 | 746 | $this->file->close(); |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | */ |
| 755 | 755 | public function setMetaData() |
| 756 | 756 | { |
| 757 | - if (empty($this->creator)) $this->creator=''; |
|
| 757 | + if (empty($this->creator)) $this->creator = ''; |
|
| 758 | 758 | |
| 759 | 759 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
| 760 | 760 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -800,8 +800,8 @@ discard block |
||
| 800 | 800 | throw new OdfException("headers already sent ($filename at $linenum)"); |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | - if ( $name == "" ) { |
|
| 804 | - $name = md5(uniqid()) . ".odt"; |
|
| 803 | + if ($name == "") { |
|
| 804 | + $name = md5(uniqid()).".odt"; |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | header('Content-type: application/vnd.oasis.opendocument.text'); |
@@ -822,18 +822,18 @@ discard block |
||
| 822 | 822 | { |
| 823 | 823 | global $conf; |
| 824 | 824 | |
| 825 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
| 825 | + if ($name == "") $name = "temp".md5(uniqid()); |
|
| 826 | 826 | |
| 827 | 827 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
| 828 | 828 | $this->saveToDisk($name); |
| 829 | 829 | |
| 830 | - $execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2 |
|
| 830 | + $execmethod = (empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : 2); // 1 or 2 |
|
| 831 | 831 | // Method 1 sometimes hang the server. |
| 832 | 832 | |
| 833 | 833 | |
| 834 | 834 | // Export to PDF using LibreOffice |
| 835 | 835 | if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') { |
| 836 | - dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable |
|
| 836 | + dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable |
|
| 837 | 837 | |
| 838 | 838 | // We delete and recreate a subdir because the soffice may have change pemrissions on it |
| 839 | 839 | $countdeleted = 0; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | // using windows libreoffice that must be in path |
| 845 | 845 | // using linux/mac libreoffice that must be in path |
| 846 | 846 | // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 |
| 847 | - $command ='soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name); |
|
| 847 | + $command = 'soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '.escapeshellarg(dirname($name))." ".escapeshellarg($name); |
|
| 848 | 848 | } elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) { |
| 849 | 849 | // If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87 |
| 850 | 850 | |
@@ -874,13 +874,13 @@ discard block |
||
| 874 | 874 | //$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name); |
| 875 | 875 | } else { |
| 876 | 876 | // deprecated old method using odt2pdf.sh (native, jodconverter, ...) |
| 877 | - $tmpname=preg_replace('/\.odt/i', '', $name); |
|
| 877 | + $tmpname = preg_replace('/\.odt/i', '', $name); |
|
| 878 | 878 | |
| 879 | 879 | if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) { |
| 880 | - $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 880 | + $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 881 | 881 | } else { |
| 882 | 882 | dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING); |
| 883 | - $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 883 | + $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | |
@@ -893,14 +893,14 @@ discard block |
||
| 893 | 893 | // $result = $utils->executeCLI($command, $outputfile); and replace test on $execmethod. |
| 894 | 894 | // $retval will be $result['result'] |
| 895 | 895 | // $errorstring will be $result['output'] |
| 896 | - $retval=0; $output_arr=array(); |
|
| 896 | + $retval = 0; $output_arr = array(); |
|
| 897 | 897 | if ($execmethod == 1) { |
| 898 | 898 | exec($command, $output_arr, $retval); |
| 899 | 899 | } |
| 900 | 900 | if ($execmethod == 2) { |
| 901 | 901 | $outputfile = DOL_DATA_ROOT.'/odt2pdf.log'; |
| 902 | 902 | |
| 903 | - $ok=0; |
|
| 903 | + $ok = 0; |
|
| 904 | 904 | $handle = fopen($outputfile, 'w'); |
| 905 | 905 | if ($handle) { |
| 906 | 906 | dol_syslog(get_class($this)."Run command ".$command, LOG_DEBUG); |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | while (!feof($handlein)) { |
| 910 | 910 | $read = fgets($handlein); |
| 911 | 911 | fwrite($handle, $read); |
| 912 | - $output_arr[]=$read; |
|
| 912 | + $output_arr[] = $read; |
|
| 913 | 913 | } |
| 914 | 914 | pclose($handlein); |
| 915 | 915 | fclose($handle); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | |
| 920 | 920 | if ($retval == 0) { |
| 921 | 921 | dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); |
| 922 | - $filename=''; $linenum=0; |
|
| 922 | + $filename = ''; $linenum = 0; |
|
| 923 | 923 | |
| 924 | 924 | if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context) |
| 925 | 925 | if (headers_sent($filename, $linenum)) { |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { |
| 930 | - $name=preg_replace('/\.od(x|t)/i', '', $name); |
|
| 930 | + $name = preg_replace('/\.od(x|t)/i', '', $name); |
|
| 931 | 931 | header('Content-type: application/pdf'); |
| 932 | 932 | header('Content-Disposition: attachment; filename="'.basename($name).'.pdf"'); |
| 933 | 933 | readfile($name.".pdf"); |
@@ -942,13 +942,13 @@ discard block |
||
| 942 | 942 | dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG); |
| 943 | 943 | |
| 944 | 944 | if ($retval == 126) { |
| 945 | - throw new OdfException('Permission execute convert script : ' . $command); |
|
| 945 | + throw new OdfException('Permission execute convert script : '.$command); |
|
| 946 | 946 | } else { |
| 947 | - $errorstring=''; |
|
| 947 | + $errorstring = ''; |
|
| 948 | 948 | foreach ($output_arr as $line) { |
| 949 | - $errorstring.= $line."<br>"; |
|
| 949 | + $errorstring .= $line."<br>"; |
|
| 950 | 950 | } |
| 951 | - throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring); |
|
| 951 | + throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : '.$errorstring); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | } |
@@ -1002,11 +1002,11 @@ discard block |
||
| 1002 | 1002 | if ($handle = opendir($dir)) { |
| 1003 | 1003 | while (($file = readdir($handle)) !== false) { |
| 1004 | 1004 | if ($file != '.' && $file != '..') { |
| 1005 | - if (is_dir($dir . '/' . $file)) { |
|
| 1006 | - $this->_rrmdir($dir . '/' . $file); |
|
| 1007 | - rmdir($dir . '/' . $file); |
|
| 1005 | + if (is_dir($dir.'/'.$file)) { |
|
| 1006 | + $this->_rrmdir($dir.'/'.$file); |
|
| 1007 | + rmdir($dir.'/'.$file); |
|
| 1008 | 1008 | } else { |
| 1009 | - unlink($dir . '/' . $file); |
|
| 1009 | + unlink($dir.'/'.$file); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | } |
| 1012 | 1012 | } |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | */ |
| 1023 | 1023 | public function getvalue($valuename) |
| 1024 | 1024 | { |
| 1025 | - $searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; |
|
| 1025 | + $searchreg = "/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; |
|
| 1026 | 1026 | $matches = array(); |
| 1027 | 1027 | preg_match($searchreg, $this->contentXml, $matches); |
| 1028 | 1028 | $this->contentXml = preg_replace($searchreg, "", $this->contentXml); |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | return 0; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $numFinal = get_next_value($db, $mask, 'paiementfourn', 'ref', '', $objsoc, is_object($object) ?$object->datepaye :''); |
|
| 142 | + $numFinal = get_next_value($db, $mask, 'paiementfourn', 'ref', '', $objsoc, is_object($object) ? $object->datepaye : ''); |
|
| 143 | 143 | |
| 144 | 144 | return $numFinal; |
| 145 | 145 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { |
| 124 | 124 | if (!empty($perm)) { |
| 125 | 125 | $tmp = explode(':', $typeofdata); |
| 126 | - $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; |
|
| 126 | + $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">'; |
|
| 127 | 127 | if ($fieldrequired) { |
| 128 | 128 | $ret .= '<span class="fieldrequired">'; |
| 129 | 129 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if ($fieldrequired) { |
| 136 | 136 | $ret .= '</span>'; |
| 137 | 137 | } |
| 138 | - $ret .= '</div>' . "\n"; |
|
| 138 | + $ret .= '</div>'."\n"; |
|
| 139 | 139 | } else { |
| 140 | 140 | if ($fieldrequired) { |
| 141 | 141 | $ret .= '<span class="fieldrequired">'; |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | if (empty($notabletag) && $perm) { |
| 174 | 174 | $ret .= '<td class="right">'; |
| 175 | 175 | } |
| 176 | - if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
| 177 | - $ret .= '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&token=' . newToken() . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>'; |
|
| 176 | + if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
| 177 | + $ret .= '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>'; |
|
| 178 | 178 | } |
| 179 | 179 | if (!empty($notabletag) && $notabletag == 1) { |
| 180 | 180 | if ($text) { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } elseif ($reg[1] == 'int') { |
| 242 | 242 | $typeofdata = 'numeric'; |
| 243 | 243 | } else { |
| 244 | - return 'ErrorBadParameter ' . $typeofdata; |
|
| 244 | + return 'ErrorBadParameter '.$typeofdata; |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | if ($editaction == '') { |
| 253 | 253 | $editaction = GETPOST('action', 'aZ09'); |
| 254 | 254 | } |
| 255 | - $editmode = ($editaction == 'edit' . $htmlname); |
|
| 255 | + $editmode = ($editaction == 'edit'.$htmlname); |
|
| 256 | 256 | if ($editmode) { // edit mode |
| 257 | 257 | $ret .= "<!-- formeditfieldval -->\n"; |
| 258 | - $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">'; |
|
| 259 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
|
| 260 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 261 | - $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; |
|
| 258 | + $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">'; |
|
| 259 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
| 260 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 261 | + $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; |
|
| 262 | 262 | if (empty($notabletag)) { |
| 263 | 263 | $ret .= '<table class="nobordernopadding centpercent">'; |
| 264 | 264 | } |
@@ -267,28 +267,28 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { |
| 269 | 269 | $tmp = explode(':', $typeofdata); |
| 270 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
| 270 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
|
| 271 | 271 | } elseif (preg_match('/^(integer)/', $typeofdata)) { |
| 272 | 272 | $tmp = explode(':', $typeofdata); |
| 273 | 273 | $valuetoshow = price2num($editvalue ? $editvalue : $value, 0); |
| 274 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
| 274 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
|
| 275 | 275 | } elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { |
| 276 | 276 | $tmp = explode(':', $typeofdata); |
| 277 | 277 | $valuetoshow = price2num($editvalue ? $editvalue : $value); |
| 278 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
| 278 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
|
| 279 | 279 | } elseif (preg_match('/^(checkbox)/', $typeofdata)) { |
| 280 | 280 | $tmp = explode(':', $typeofdata); |
| 281 | - $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>'; |
|
| 281 | + $ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>'; |
|
| 282 | 282 | } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor' |
| 283 | 283 | $tmp = explode(':', $typeofdata); |
| 284 | 284 | $cols = (empty($tmp[2]) ? '' : $tmp[2]); |
| 285 | 285 | $morealt = ''; |
| 286 | 286 | if (preg_match('/%/', $cols)) { |
| 287 | - $morealt = ' style="width: ' . $cols . '"'; |
|
| 287 | + $morealt = ' style="width: '.$cols.'"'; |
|
| 288 | 288 | $cols = ''; |
| 289 | 289 | } |
| 290 | 290 | $valuetoshow = ($editvalue ? $editvalue : $value); |
| 291 | - $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>'; |
|
| 291 | + $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>'; |
|
| 292 | 292 | // textarea convert automatically entities chars into simple chars. |
| 293 | 293 | // So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwyg is off. |
| 294 | 294 | $valuetoshow = str_replace('&', '&', $valuetoshow); |
@@ -298,12 +298,12 @@ discard block |
||
| 298 | 298 | $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
| 299 | 299 | $adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
| 300 | 300 | $labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
| 301 | - $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
| 301 | + $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
| 302 | 302 | } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
| 303 | 303 | $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
| 304 | 304 | $adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
| 305 | 305 | $labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
| 306 | - $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
| 306 | + $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
| 307 | 307 | } elseif (preg_match('/^select;/', $typeofdata)) { |
| 308 | 308 | $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
| 309 | 309 | $arraylist = array(); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | // TODO Not yet implemented. See code for extrafields |
| 318 | 318 | } elseif (preg_match('/^ckeditor/', $typeofdata)) { |
| 319 | 319 | $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser |
| 320 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 320 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 321 | 321 | $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? false : (bool) $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? 20 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7])); |
| 322 | 322 | $ret .= $doleditor->Create(1); |
| 323 | 323 | } elseif ($typeofdata == 'asis') { |
@@ -332,19 +332,19 @@ discard block |
||
| 332 | 332 | $ret .= '<td>'; |
| 333 | 333 | } |
| 334 | 334 | //else $ret.='<div class="clearboth"></div>'; |
| 335 | - $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
|
| 335 | + $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; |
|
| 336 | 336 | if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { |
| 337 | - $ret .= '<br>' . "\n"; |
|
| 337 | + $ret .= '<br>'."\n"; |
|
| 338 | 338 | } |
| 339 | - $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 339 | + $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 340 | 340 | if (empty($notabletag)) { |
| 341 | 341 | $ret .= '</td>'; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | if (empty($notabletag)) { |
| 345 | - $ret .= '</tr></table>' . "\n"; |
|
| 345 | + $ret .= '</tr></table>'."\n"; |
|
| 346 | 346 | } |
| 347 | - $ret .= '</form>' . "\n"; |
|
| 347 | + $ret .= '</form>'."\n"; |
|
| 348 | 348 | } else { // view mode |
| 349 | 349 | if (preg_match('/^email/', $typeofdata)) { |
| 350 | 350 | $ret .= dol_print_email($value, 0, 0, 0, 0, 1); |
@@ -356,15 +356,15 @@ discard block |
||
| 356 | 356 | $ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : ''); |
| 357 | 357 | } elseif (preg_match('/^checkbox/', $typeofdata)) { |
| 358 | 358 | $tmp = explode(':', $typeofdata); |
| 359 | - $ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>'; |
|
| 359 | + $ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>'; |
|
| 360 | 360 | } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { |
| 361 | 361 | $ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1)); |
| 362 | 362 | } elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) { // 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' |
| 363 | 363 | $ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value)); |
| 364 | 364 | } elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { |
| 365 | - $ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>'; |
|
| 365 | + $ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>'; |
|
| 366 | 366 | } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
| 367 | - $ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>'; |
|
| 367 | + $ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>'; |
|
| 368 | 368 | } elseif (preg_match('/^select;/', $typeofdata)) { |
| 369 | 369 | $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
| 370 | 370 | $arraylist = array(); |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | $ret .= $arraylist[$value]; |
| 376 | 376 | if ($htmlname == 'fk_product_type') { |
| 377 | 377 | if ($value == 0) { |
| 378 | - $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
| 378 | + $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
|
| 379 | 379 | } else { |
| 380 | - $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
| 380 | + $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | } elseif (preg_match('/^ckeditor/', $typeofdata)) { |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { |
| 386 | 386 | $firstline = preg_replace('/<br>.*/', '', $tmpcontent); |
| 387 | 387 | $firstline = preg_replace('/[\n\r].*/', '', $firstline); |
| 388 | - $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
| 388 | + $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
| 389 | 389 | } |
| 390 | 390 | // We don't use dol_escape_htmltag to get the html formatting active, but this need we must also |
| 391 | 391 | // clean data from some dangerous html |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | if (empty($moreoptions['valuealreadyhtmlescaped'])) { |
| 395 | 395 | $ret .= dol_escape_htmltag($value); |
| 396 | 396 | } else { |
| 397 | - $ret .= $value; // $value must be already html escaped. |
|
| 397 | + $ret .= $value; // $value must be already html escaped. |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
| 434 | 434 | if (!is_object($extralanguages)) { |
| 435 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
| 435 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
|
| 436 | 436 | $extralanguages = new ExtraLanguages($this->db); |
| 437 | 437 | } |
| 438 | 438 | $extralanguages->fetch_name_extralanguages('societe'); |
@@ -441,17 +441,17 @@ discard block |
||
| 441 | 441 | return ''; // No extralang field to show |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - $result .= '<!-- Widget for translation -->' . "\n"; |
|
| 445 | - $result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">'; |
|
| 444 | + $result .= '<!-- Widget for translation -->'."\n"; |
|
| 445 | + $result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">'; |
|
| 446 | 446 | $s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', 0, 0, 0, '', 'fa-15 editfieldlang'); |
| 447 | 447 | $result .= $s; |
| 448 | 448 | $result .= '</div>'; |
| 449 | 449 | |
| 450 | - $result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">'; |
|
| 450 | + $result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">'; |
|
| 451 | 451 | |
| 452 | 452 | $resultforextrlang = ''; |
| 453 | 453 | foreach ($arrayoflangcode as $langcode) { |
| 454 | - $valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; |
|
| 454 | + $valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; |
|
| 455 | 455 | if (empty($valuetoshow)) { |
| 456 | 456 | $object->fetchValuesForExtraLanguages(); |
| 457 | 457 | //var_dump($object->array_languages); |
@@ -463,17 +463,17 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | // TODO Use the showInputField() method of ExtraLanguages object |
| 465 | 465 | if ($typeofdata == 'textarea') { |
| 466 | - $resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">'; |
|
| 466 | + $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">'; |
|
| 467 | 467 | $resultforextrlang .= $valuetoshow; |
| 468 | 468 | $resultforextrlang .= '</textarea>'; |
| 469 | 469 | } else { |
| 470 | - $resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">'; |
|
| 470 | + $resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">'; |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | $result .= $resultforextrlang; |
| 474 | 474 | |
| 475 | 475 | $result .= '</div>'; |
| 476 | - $result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; |
|
| 476 | + $result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | return $result; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | if (!empty($tmp[2])) { |
| 537 | 537 | $savemethod = $tmp[2]; |
| 538 | 538 | } |
| 539 | - $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; |
|
| 539 | + $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n"; |
|
| 540 | 540 | } elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
| 541 | 541 | $tmp = explode(':', $inputType); |
| 542 | 542 | $inputType = $tmp[0]; |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $savemethod = $tmp[2]; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format |
|
| 550 | + $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format |
|
| 551 | 551 | } elseif (preg_match('/^(select|autocomplete)/', $inputType)) { |
| 552 | 552 | $tmp = explode(':', $inputType); |
| 553 | 553 | $inputType = $tmp[0]; |
@@ -578,40 +578,40 @@ discard block |
||
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | if (isModEnabled('fckeditor')) { |
| 581 | - $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; |
|
| 581 | + $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n"; |
|
| 582 | 582 | } else { |
| 583 | 583 | $inputType = 'textarea'; |
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n"; |
|
| 588 | - $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; |
|
| 589 | - $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; |
|
| 590 | - $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; |
|
| 587 | + $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n"; |
|
| 588 | + $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n"; |
|
| 589 | + $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n"; |
|
| 590 | + $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n"; |
|
| 591 | 591 | if (!empty($savemethod)) { |
| 592 | - $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
| 592 | + $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; |
|
| 593 | 593 | } |
| 594 | 594 | if (!empty($ext_element)) { |
| 595 | - $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
| 595 | + $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; |
|
| 596 | 596 | } |
| 597 | 597 | if (!empty($custommsg)) { |
| 598 | 598 | if (is_array($custommsg)) { |
| 599 | 599 | if (!empty($custommsg['success'])) { |
| 600 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
| 600 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n"; |
|
| 601 | 601 | } |
| 602 | 602 | if (!empty($custommsg['error'])) { |
| 603 | - $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
| 603 | + $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n"; |
|
| 604 | 604 | } |
| 605 | 605 | } else { |
| 606 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
| 606 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n"; |
|
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | 609 | if ($inputType == 'textarea') { |
| 610 | - $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; |
|
| 611 | - $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n"; |
|
| 610 | + $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n"; |
|
| 611 | + $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n"; |
|
| 612 | 612 | } |
| 613 | - $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n"; |
|
| 614 | - $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n"; |
|
| 613 | + $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; |
|
| 614 | + $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n"; |
|
| 615 | 615 | } else { |
| 616 | 616 | $out = $value; |
| 617 | 617 | } |
@@ -640,12 +640,12 @@ discard block |
||
| 640 | 640 | public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) |
| 641 | 641 | { |
| 642 | 642 | if ($incbefore) { |
| 643 | - $text = $incbefore . $text; |
|
| 643 | + $text = $incbefore.$text; |
|
| 644 | 644 | } |
| 645 | 645 | if (!$htmltext) { |
| 646 | 646 | return $text; |
| 647 | 647 | } |
| 648 | - $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
|
| 648 | + $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
|
| 649 | 649 | |
| 650 | 650 | $tag = 'td'; |
| 651 | 651 | if ($notabs == 2) { |
@@ -659,11 +659,11 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | $extrastyle = ''; |
| 661 | 661 | if ($direction < 0) { |
| 662 | - $extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : ''); |
|
| 662 | + $extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : ''); |
|
| 663 | 663 | $extrastyle = 'padding: 0px; padding-left: 2px;'; |
| 664 | 664 | } |
| 665 | 665 | if ($direction > 0) { |
| 666 | - $extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : ''); |
|
| 666 | + $extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : ''); |
|
| 667 | 667 | $extrastyle = 'padding: 0px; padding-right: 2px;'; |
| 668 | 668 | } |
| 669 | 669 | |
@@ -676,53 +676,53 @@ discard block |
||
| 676 | 676 | $htmltext = str_replace('"', '"', $htmltext); |
| 677 | 677 | } else { |
| 678 | 678 | $classfortooltip = 'classfortooltiponclick'; |
| 679 | - $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; |
|
| 679 | + $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; |
|
| 680 | 680 | } |
| 681 | 681 | if ($tooltipon == 2 || $tooltipon == 3) { |
| 682 | - $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; |
|
| 682 | + $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; |
|
| 683 | 683 | if ($tooltiptrigger == '') { |
| 684 | - $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip |
|
| 684 | + $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip |
|
| 685 | 685 | } else { |
| 686 | - $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; |
|
| 686 | + $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; |
|
| 687 | 687 | } |
| 688 | 688 | } else { |
| 689 | - $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
| 689 | + $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
|
| 690 | 690 | } |
| 691 | 691 | if ($tooltipon == 1 || $tooltipon == 3) { |
| 692 | - $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; |
|
| 692 | + $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; |
|
| 693 | 693 | if ($tooltiptrigger == '') { |
| 694 | - $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip |
|
| 694 | + $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip |
|
| 695 | 695 | } else { |
| 696 | - $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; |
|
| 696 | + $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; |
|
| 697 | 697 | } |
| 698 | 698 | } else { |
| 699 | - $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
| 699 | + $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
|
| 700 | 700 | } |
| 701 | 701 | if (empty($notabs)) { |
| 702 | 702 | $s .= '<table class="nobordernopadding"><tr style="height: auto;">'; |
| 703 | 703 | } elseif ($notabs == 2) { |
| 704 | - $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; |
|
| 704 | + $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; |
|
| 705 | 705 | } |
| 706 | 706 | // Define value if value is before |
| 707 | 707 | if ($direction < 0) { |
| 708 | - $s .= '<' . $tag . $paramfortooltipimg; |
|
| 708 | + $s .= '<'.$tag.$paramfortooltipimg; |
|
| 709 | 709 | if ($tag == 'td') { |
| 710 | 710 | $s .= ' class="valigntop" width="14"'; |
| 711 | 711 | } |
| 712 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
| 712 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
|
| 713 | 713 | } |
| 714 | 714 | // Use another method to help avoid having a space in value in order to use this value with jquery |
| 715 | 715 | // Define label |
| 716 | 716 | if ((string) $text != '') { |
| 717 | - $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; |
|
| 717 | + $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; |
|
| 718 | 718 | } |
| 719 | 719 | // Define value if value is after |
| 720 | 720 | if ($direction > 0) { |
| 721 | - $s .= '<' . $tag . $paramfortooltipimg; |
|
| 721 | + $s .= '<'.$tag.$paramfortooltipimg; |
|
| 722 | 722 | if ($tag == 'td') { |
| 723 | 723 | $s .= ' class="valignmiddle" width="14"'; |
| 724 | 724 | } |
| 725 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
| 725 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
|
| 726 | 726 | } |
| 727 | 727 | if (empty($notabs)) { |
| 728 | 728 | $s .= '</tr></table>'; |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | |
| 830 | 830 | $disabled = 0; |
| 831 | 831 | $ret = '<div class="centpercent center">'; |
| 832 | - $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>'; |
|
| 832 | + $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>'; |
|
| 833 | 833 | |
| 834 | 834 | // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. |
| 835 | 835 | $parameters = array(); |
@@ -840,10 +840,10 @@ discard block |
||
| 840 | 840 | return; |
| 841 | 841 | } |
| 842 | 842 | if (empty($reshook)) { |
| 843 | - $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; |
|
| 843 | + $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; |
|
| 844 | 844 | if (is_array($arrayofaction)) { |
| 845 | 845 | foreach ($arrayofaction as $code => $label) { |
| 846 | - $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>'; |
|
| 846 | + $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>'; |
|
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | } |
@@ -852,17 +852,17 @@ discard block |
||
| 852 | 852 | $ret .= '</select>'; |
| 853 | 853 | |
| 854 | 854 | if (empty($conf->dol_optimize_smallscreen)) { |
| 855 | - $ret .= ajax_combobox('.' . $name . 'select'); |
|
| 855 | + $ret .= ajax_combobox('.'.$name.'select'); |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button |
| 859 | 859 | $ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER. |
| 860 | - $ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">'; |
|
| 860 | + $ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; |
|
| 861 | 861 | $ret .= '</div>'; |
| 862 | 862 | |
| 863 | 863 | if (!empty($conf->use_javascript_ajax)) { |
| 864 | 864 | $ret .= '<!-- JS CODE TO ENABLE mass action select --> |
| 865 | - <script nonce="' . getNonce() . '"> |
|
| 865 | + <script nonce="' . getNonce().'"> |
|
| 866 | 866 | function initCheckForSelect(mode, name, cssclass) /* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */ |
| 867 | 867 | { |
| 868 | 868 | atleastoneselected=0; |
@@ -873,11 +873,11 @@ discard block |
||
| 873 | 873 | |
| 874 | 874 | console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); |
| 875 | 875 | |
| 876 | - if (atleastoneselected || ' . $alwaysvisible . ') |
|
| 876 | + if (atleastoneselected || ' . $alwaysvisible.') |
|
| 877 | 877 | { |
| 878 | 878 | jQuery("."+name).show(); |
| 879 | - ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' |
|
| 880 | - ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' |
|
| 879 | + ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' |
|
| 880 | + ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' |
|
| 881 | 881 | } |
| 882 | 882 | else |
| 883 | 883 | { |
@@ -887,26 +887,26 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | jQuery(document).ready(function () { |
| 890 | - initCheckForSelect(0, "' . $name . '", "' . $cssclass . '"); |
|
| 891 | - jQuery(".' . $cssclass . '").click(function() { |
|
| 892 | - initCheckForSelect(1, "' . $name . '", "' . $cssclass . '"); |
|
| 890 | + initCheckForSelect(0, "' . $name.'", "'.$cssclass.'"); |
|
| 891 | + jQuery(".' . $cssclass.'").click(function() { |
|
| 892 | + initCheckForSelect(1, "' . $name.'", "'.$cssclass.'"); |
|
| 893 | 893 | }); |
| 894 | - jQuery(".' . $name . 'select").change(function() { |
|
| 894 | + jQuery(".' . $name.'select").change(function() { |
|
| 895 | 895 | var massaction = $( this ).val(); |
| 896 | 896 | var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); |
| 897 | 897 | if (massaction == "builddoc") { |
| 898 | 898 | urlform = urlform + "#show_files"; |
| 899 | 899 | } |
| 900 | 900 | $( this ).closest("form").attr("action", urlform); |
| 901 | - console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); |
|
| 901 | + console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); |
|
| 902 | 902 | /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ |
| 903 | 903 | if ($(this).val() != \'0\') { |
| 904 | - jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); |
|
| 905 | - jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ |
|
| 906 | - jQuery(".' . $name . '"+massaction).show(); |
|
| 904 | + jQuery(".' . $name.'confirmed").prop(\'disabled\', false); |
|
| 905 | + jQuery(".' . $name.'other").hide(); /* To disable if another div was open */ |
|
| 906 | + jQuery(".' . $name.'"+massaction).show(); |
|
| 907 | 907 | } else { |
| 908 | - jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); |
|
| 909 | - jQuery(".' . $name . 'other").hide(); /* To disable any div open */ |
|
| 908 | + jQuery(".' . $name.'confirmed").prop(\'disabled\', true); |
|
| 909 | + jQuery(".' . $name.'other").hide(); /* To disable any div open */ |
|
| 910 | 910 | } |
| 911 | 911 | }); |
| 912 | 912 | }); |
@@ -949,14 +949,14 @@ discard block |
||
| 949 | 949 | $atleastonefavorite = 0; |
| 950 | 950 | |
| 951 | 951 | $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; |
| 952 | - $sql .= " FROM " . $this->db->prefix() . "c_country"; |
|
| 952 | + $sql .= " FROM ".$this->db->prefix()."c_country"; |
|
| 953 | 953 | $sql .= " WHERE active > 0"; |
| 954 | 954 | //$sql.= " ORDER BY code ASC"; |
| 955 | 955 | |
| 956 | - dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
| 956 | + dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
|
| 957 | 957 | $resql = $this->db->query($sql); |
| 958 | 958 | if ($resql) { |
| 959 | - $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
| 959 | + $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
|
| 960 | 960 | $num = $this->db->num_rows($resql); |
| 961 | 961 | $i = 0; |
| 962 | 962 | if ($num) { |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | $countryArray[$i]['rowid'] = $obj->rowid; |
| 967 | 967 | $countryArray[$i]['code_iso'] = $obj->code_iso; |
| 968 | 968 | $countryArray[$i]['code_iso3'] = $obj->code_iso3; |
| 969 | - $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
| 969 | + $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
| 970 | 970 | $countryArray[$i]['favorite'] = $obj->favorite; |
| 971 | 971 | $countryArray[$i]['eec'] = $obj->eec; |
| 972 | 972 | $favorite[$i] = $obj->favorite; |
@@ -984,20 +984,20 @@ discard block |
||
| 984 | 984 | |
| 985 | 985 | if ($showempty) { |
| 986 | 986 | if (is_numeric($showempty)) { |
| 987 | - $out .= '<option value=""> </option>' . "\n"; |
|
| 987 | + $out .= '<option value=""> </option>'."\n"; |
|
| 988 | 988 | } else { |
| 989 | - $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; |
|
| 989 | + $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; |
|
| 990 | 990 | } |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | if ($addspecialentries) { // Add dedicated entries for groups of countries |
| 994 | 994 | //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
| 995 | - $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
| 996 | - $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
| 995 | + $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
| 996 | + $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
|
| 997 | 997 | if ($mysoc->isInEEC()) { |
| 998 | - $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
| 998 | + $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
| 999 | 999 | } |
| 1000 | - $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
| 1000 | + $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
|
| 1001 | 1001 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -1025,20 +1025,20 @@ discard block |
||
| 1025 | 1025 | $labeltoshow .= ' '; |
| 1026 | 1026 | } |
| 1027 | 1027 | if ($row['code_iso']) { |
| 1028 | - $labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; |
|
| 1028 | + $labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; |
|
| 1029 | 1029 | if (empty($hideflags)) { |
| 1030 | 1030 | $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); |
| 1031 | - $labeltoshow = $tmpflag . ' ' . $labeltoshow; |
|
| 1031 | + $labeltoshow = $tmpflag.' '.$labeltoshow; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
| 1036 | - $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
| 1036 | + $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; |
|
| 1037 | 1037 | } else { |
| 1038 | - $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
| 1038 | + $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | $out .= $labeltoshow; |
| 1041 | - $out .= '</option>' . "\n"; |
|
| 1041 | + $out .= '</option>'."\n"; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | } |
| 1044 | 1044 | $out .= '</select>'; |
@@ -1047,8 +1047,8 @@ discard block |
||
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | // Make select dynamic |
| 1050 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 1051 | - $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); |
|
| 1050 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 1051 | + $out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); |
|
| 1052 | 1052 | |
| 1053 | 1053 | return $out; |
| 1054 | 1054 | } |
@@ -1080,25 +1080,25 @@ discard block |
||
| 1080 | 1080 | $incotermArray = array(); |
| 1081 | 1081 | |
| 1082 | 1082 | $sql = "SELECT rowid, code"; |
| 1083 | - $sql .= " FROM " . $this->db->prefix() . "c_incoterms"; |
|
| 1083 | + $sql .= " FROM ".$this->db->prefix()."c_incoterms"; |
|
| 1084 | 1084 | $sql .= " WHERE active > 0"; |
| 1085 | 1085 | $sql .= " ORDER BY code ASC"; |
| 1086 | 1086 | |
| 1087 | - dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
| 1087 | + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
|
| 1088 | 1088 | $resql = $this->db->query($sql); |
| 1089 | 1089 | if ($resql) { |
| 1090 | 1090 | if ($conf->use_javascript_ajax && !$forcecombo) { |
| 1091 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 1091 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 1092 | 1092 | $out .= ajax_combobox($htmlname, $events); |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | if (!empty($page)) { |
| 1096 | - $out .= '<form method="post" action="' . $page . '">'; |
|
| 1096 | + $out .= '<form method="post" action="'.$page.'">'; |
|
| 1097 | 1097 | $out .= '<input type="hidden" name="action" value="set_incoterms">'; |
| 1098 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 1098 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | - $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
| 1101 | + $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; |
|
| 1102 | 1102 | $out .= '<option value="0"> </option>'; |
| 1103 | 1103 | $num = $this->db->num_rows($resql); |
| 1104 | 1104 | $i = 0; |
@@ -1112,9 +1112,9 @@ discard block |
||
| 1112 | 1112 | |
| 1113 | 1113 | foreach ($incotermArray as $row) { |
| 1114 | 1114 | if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
| 1115 | - $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
| 1115 | + $out .= '<option value="'.$row['rowid'].'" selected>'; |
|
| 1116 | 1116 | } else { |
| 1117 | - $out .= '<option value="' . $row['rowid'] . '">'; |
|
| 1117 | + $out .= '<option value="'.$row['rowid'].'">'; |
|
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | 1120 | if ($row['code']) { |
@@ -1128,13 +1128,13 @@ discard block |
||
| 1128 | 1128 | $out .= ajax_combobox($htmlname); |
| 1129 | 1129 | |
| 1130 | 1130 | if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
| 1131 | - $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
| 1131 | + $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
|
| 1132 | 1132 | $moreattrib .= ' autocomplete="off"'; |
| 1133 | 1133 | } |
| 1134 | - $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
| 1134 | + $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
|
| 1135 | 1135 | |
| 1136 | 1136 | if (!empty($page)) { |
| 1137 | - $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
| 1137 | + $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
|
| 1138 | 1138 | } |
| 1139 | 1139 | } else { |
| 1140 | 1140 | dol_print_error($this->db); |
@@ -1166,9 +1166,9 @@ discard block |
||
| 1166 | 1166 | if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
| 1167 | 1167 | || (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
| 1168 | 1168 | if (empty($hidetext)) { |
| 1169 | - print $langs->trans("Type") . ': '; |
|
| 1169 | + print $langs->trans("Type").': '; |
|
| 1170 | 1170 | } |
| 1171 | - print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 1171 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 1172 | 1172 | if ($showempty) { |
| 1173 | 1173 | print '<option value="-1"'; |
| 1174 | 1174 | if ($selected == -1) { |
@@ -1187,28 +1187,28 @@ discard block |
||
| 1187 | 1187 | if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
| 1188 | 1188 | print ' selected'; |
| 1189 | 1189 | } |
| 1190 | - print '>' . $langs->trans("Product"); |
|
| 1190 | + print '>'.$langs->trans("Product"); |
|
| 1191 | 1191 | |
| 1192 | 1192 | print '<option value="1"'; |
| 1193 | 1193 | if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
| 1194 | 1194 | print ' selected'; |
| 1195 | 1195 | } |
| 1196 | - print '>' . $langs->trans("Service"); |
|
| 1196 | + print '>'.$langs->trans("Service"); |
|
| 1197 | 1197 | |
| 1198 | 1198 | print '</select>'; |
| 1199 | - print ajax_combobox('select_' . $htmlname); |
|
| 1199 | + print ajax_combobox('select_'.$htmlname); |
|
| 1200 | 1200 | //if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
| 1201 | 1201 | } |
| 1202 | 1202 | if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
| 1203 | 1203 | print $langs->trans("Service"); |
| 1204 | - print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
| 1204 | + print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
|
| 1205 | 1205 | } |
| 1206 | 1206 | if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
| 1207 | 1207 | print $langs->trans("Product"); |
| 1208 | - print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
| 1208 | + print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
|
| 1209 | 1209 | } |
| 1210 | 1210 | if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
| 1211 | - print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
| 1211 | + print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
| 1212 | 1212 | } |
| 1213 | 1213 | } |
| 1214 | 1214 | |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | $langs->load("trips"); |
| 1235 | 1235 | |
| 1236 | 1236 | $sql = "SELECT c.code, c.label"; |
| 1237 | - $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
| 1237 | + $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
|
| 1238 | 1238 | $sql .= " WHERE active > 0"; |
| 1239 | 1239 | |
| 1240 | 1240 | $resql = $this->db->query($sql); |
@@ -1275,11 +1275,11 @@ discard block |
||
| 1275 | 1275 | // phpcs:enable |
| 1276 | 1276 | global $user, $langs; |
| 1277 | 1277 | |
| 1278 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
| 1278 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
| 1279 | 1279 | |
| 1280 | 1280 | $this->load_cache_types_fees(); |
| 1281 | 1281 | |
| 1282 | - print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
| 1282 | + print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
|
| 1283 | 1283 | if ($showempty) { |
| 1284 | 1284 | print '<option value="-1"'; |
| 1285 | 1285 | if ($selected == -1) { |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | foreach ($this->cache_types_fees as $key => $value) { |
| 1292 | - print '<option value="' . $key . '"'; |
|
| 1292 | + print '<option value="'.$key.'"'; |
|
| 1293 | 1293 | if ($key == $selected) { |
| 1294 | 1294 | print ' selected'; |
| 1295 | 1295 | } |
@@ -1341,12 +1341,12 @@ discard block |
||
| 1341 | 1341 | $ajaxoptions = array(); |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 1344 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 1345 | 1345 | |
| 1346 | 1346 | // No immediate load of all database |
| 1347 | 1347 | $placeholder = ''; |
| 1348 | 1348 | if ($selected && empty($selected_input_value)) { |
| 1349 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 1349 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 1350 | 1350 | $societetmp = new Societe($this->db); |
| 1351 | 1351 | $societetmp->fetch($selected); |
| 1352 | 1352 | $selected_input_value = $societetmp->name; |
@@ -1354,11 +1354,11 @@ discard block |
||
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | 1356 | // mode 1 |
| 1357 | - $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); |
|
| 1357 | + $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : ''); |
|
| 1358 | 1358 | |
| 1359 | 1359 | $out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
| 1360 | 1360 | if (empty($hidelabel)) { |
| 1361 | - $out .= $langs->trans("RefOrLabel") . ' : '; |
|
| 1361 | + $out .= $langs->trans("RefOrLabel").' : '; |
|
| 1362 | 1362 | } elseif ($hidelabel == 1 && !is_numeric($showempty)) { |
| 1363 | 1363 | $placeholder = $langs->trans($showempty); |
| 1364 | 1364 | } elseif ($hidelabel > 1) { |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 1368 | 1368 | } |
| 1369 | 1369 | } |
| 1370 | - $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
| 1370 | + $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
|
| 1371 | 1371 | if ($hidelabel == 3) { |
| 1372 | 1372 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 1373 | 1373 | } |
@@ -1429,12 +1429,12 @@ discard block |
||
| 1429 | 1429 | $events = array(); |
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 1432 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 1433 | 1433 | |
| 1434 | 1434 | // No immediate load of all database |
| 1435 | 1435 | $placeholder = ''; |
| 1436 | 1436 | if ($selected && empty($selected_input_value)) { |
| 1437 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 1437 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 1438 | 1438 | $contacttmp = new Contact($this->db); |
| 1439 | 1439 | $contacttmp->fetch($selected); |
| 1440 | 1440 | $selected_input_value = $contacttmp->getFullName($langs); |
@@ -1445,11 +1445,11 @@ discard block |
||
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | // mode 1 |
| 1448 | - $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); |
|
| 1448 | + $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); |
|
| 1449 | 1449 | |
| 1450 | 1450 | $out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
| 1451 | 1451 | |
| 1452 | - $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
| 1452 | + $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
|
| 1453 | 1453 | |
| 1454 | 1454 | $out .= ajax_event($htmlname, $events); |
| 1455 | 1455 | |
@@ -1546,30 +1546,30 @@ discard block |
||
| 1546 | 1546 | $sql .= ", s.address, s.zip, s.town"; |
| 1547 | 1547 | $sql .= ", dictp.code as country_code"; |
| 1548 | 1548 | } |
| 1549 | - $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
| 1549 | + $sql .= " FROM ".$this->db->prefix()."societe as s"; |
|
| 1550 | 1550 | if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
| 1551 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
| 1551 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
| 1552 | 1552 | } |
| 1553 | 1553 | if (!$user->hasRight('societe', 'client', 'voir')) { |
| 1554 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
| 1554 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
|
| 1555 | 1555 | } |
| 1556 | - $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
| 1556 | + $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
|
| 1557 | 1557 | if (!empty($user->socid)) { |
| 1558 | - $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
| 1558 | + $sql .= " AND s.rowid = ".((int) $user->socid); |
|
| 1559 | 1559 | } |
| 1560 | 1560 | if ($filter) { |
| 1561 | 1561 | // $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
| 1562 | 1562 | // if not, by testSqlAndScriptInject() only. |
| 1563 | - $sql .= " AND (" . $filter . ")"; |
|
| 1563 | + $sql .= " AND (".$filter.")"; |
|
| 1564 | 1564 | } |
| 1565 | 1565 | if (!$user->hasRight('societe', 'client', 'voir')) { |
| 1566 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
| 1566 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
|
| 1567 | 1567 | } |
| 1568 | 1568 | if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
| 1569 | 1569 | $sql .= " AND s.status <> 0"; |
| 1570 | 1570 | } |
| 1571 | 1571 | if (!empty($excludeids)) { |
| 1572 | - $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; |
|
| 1572 | + $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | // Add where from hooks |
| 1575 | 1575 | $parameters = array(); |
@@ -1589,17 +1589,17 @@ discard block |
||
| 1589 | 1589 | if ($i > 0) { |
| 1590 | 1590 | $sql .= " AND "; |
| 1591 | 1591 | } |
| 1592 | - $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
| 1592 | + $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
|
| 1593 | 1593 | $i++; |
| 1594 | 1594 | } |
| 1595 | 1595 | if (count($search_crit) > 1) { |
| 1596 | 1596 | $sql .= ")"; |
| 1597 | 1597 | } |
| 1598 | 1598 | if (isModEnabled('barcode')) { |
| 1599 | - $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
| 1599 | + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
| 1600 | 1600 | } |
| 1601 | - $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
| 1602 | - $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
| 1601 | + $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
| 1602 | + $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
| 1603 | 1603 | $sql .= ")"; |
| 1604 | 1604 | } |
| 1605 | 1605 | $sql .= $this->db->order("nom", "ASC"); |
@@ -1610,7 +1610,7 @@ discard block |
||
| 1610 | 1610 | $resql = $this->db->query($sql); |
| 1611 | 1611 | if ($resql) { |
| 1612 | 1612 | // Construct $out and $outarray |
| 1613 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
| 1613 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
|
| 1614 | 1614 | |
| 1615 | 1615 | $textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
| 1616 | 1616 | if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | } |
| 1624 | 1624 | } |
| 1625 | 1625 | if ($showempty) { |
| 1626 | - $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
| 1626 | + $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
|
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | $companytemp = new Societe($this->db); |
@@ -1636,18 +1636,18 @@ discard block |
||
| 1636 | 1636 | $label = ''; |
| 1637 | 1637 | if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
| 1638 | 1638 | if (($obj->client) && (!empty($obj->code_client))) { |
| 1639 | - $label = $obj->code_client . ' - '; |
|
| 1639 | + $label = $obj->code_client.' - '; |
|
| 1640 | 1640 | } |
| 1641 | 1641 | if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
| 1642 | - $label .= $obj->code_fournisseur . ' - '; |
|
| 1642 | + $label .= $obj->code_fournisseur.' - '; |
|
| 1643 | 1643 | } |
| 1644 | - $label .= ' ' . $obj->name; |
|
| 1644 | + $label .= ' '.$obj->name; |
|
| 1645 | 1645 | } else { |
| 1646 | 1646 | $label = $obj->name; |
| 1647 | 1647 | } |
| 1648 | 1648 | |
| 1649 | 1649 | if (!empty($obj->name_alias)) { |
| 1650 | - $label .= ' (' . $obj->name_alias . ')'; |
|
| 1650 | + $label .= ' ('.$obj->name_alias.')'; |
|
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
@@ -1662,7 +1662,7 @@ discard block |
||
| 1662 | 1662 | $companytemp->fournisseur = $obj->fournisseur; |
| 1663 | 1663 | $tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
| 1664 | 1664 | if ($tmptype) { |
| 1665 | - $labelhtml .= ' ' . $tmptype; |
|
| 1665 | + $labelhtml .= ' '.$tmptype; |
|
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | 1668 | if ($obj->client || $obj->fournisseur) { |
@@ -1672,10 +1672,10 @@ discard block |
||
| 1672 | 1672 | $label .= $langs->trans("Customer"); |
| 1673 | 1673 | } |
| 1674 | 1674 | if ($obj->client == 2 || $obj->client == 3) { |
| 1675 | - $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
| 1675 | + $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
|
| 1676 | 1676 | } |
| 1677 | 1677 | if ($obj->fournisseur) { |
| 1678 | - $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
| 1678 | + $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
|
| 1679 | 1679 | } |
| 1680 | 1680 | if ($obj->client || $obj->fournisseur) { |
| 1681 | 1681 | $label .= ')'; |
@@ -1683,9 +1683,9 @@ discard block |
||
| 1683 | 1683 | } |
| 1684 | 1684 | |
| 1685 | 1685 | if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
| 1686 | - $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
| 1686 | + $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
|
| 1687 | 1687 | if (!empty($obj->country_code)) { |
| 1688 | - $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
| 1688 | + $s .= ', '.$langs->trans('Country'.$obj->country_code); |
|
| 1689 | 1689 | } |
| 1690 | 1690 | $label .= $s; |
| 1691 | 1691 | $labelhtml .= $s; |
@@ -1693,9 +1693,9 @@ discard block |
||
| 1693 | 1693 | |
| 1694 | 1694 | if (empty($outputmode)) { |
| 1695 | 1695 | if (in_array($obj->rowid, $selected)) { |
| 1696 | - $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
| 1696 | + $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
|
| 1697 | 1697 | } else { |
| 1698 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
| 1698 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
|
| 1699 | 1699 | } |
| 1700 | 1700 | } else { |
| 1701 | 1701 | array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
@@ -1707,9 +1707,9 @@ discard block |
||
| 1707 | 1707 | } |
| 1708 | 1708 | } |
| 1709 | 1709 | } |
| 1710 | - $out .= '</select>' . "\n"; |
|
| 1710 | + $out .= '</select>'."\n"; |
|
| 1711 | 1711 | if (!$forcecombo) { |
| 1712 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 1712 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 1713 | 1713 | $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); |
| 1714 | 1714 | } |
| 1715 | 1715 | } else { |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | } |
| 1799 | 1799 | |
| 1800 | 1800 | if (!is_object($hookmanager)) { |
| 1801 | - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
| 1801 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
| 1802 | 1802 | $hookmanager = new HookManager($this->db); |
| 1803 | 1803 | } |
| 1804 | 1804 | |
@@ -1807,14 +1807,14 @@ discard block |
||
| 1807 | 1807 | if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
| 1808 | 1808 | $sql .= ", s.nom as company, s.town AS company_town"; |
| 1809 | 1809 | } |
| 1810 | - $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
| 1810 | + $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
|
| 1811 | 1811 | if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
| 1812 | - $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
| 1812 | + $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
|
| 1813 | 1813 | } |
| 1814 | - $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
| 1814 | + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
|
| 1815 | 1815 | $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact |
| 1816 | 1816 | if ($socid > 0 || $socid == -1) { |
| 1817 | - $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
| 1817 | + $sql .= " AND sp.fk_soc = ".((int) $socid); |
|
| 1818 | 1818 | } |
| 1819 | 1819 | if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
| 1820 | 1820 | $sql .= " AND sp.statut <> 0"; |
@@ -1822,7 +1822,7 @@ discard block |
||
| 1822 | 1822 | if ($filter) { |
| 1823 | 1823 | // $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
| 1824 | 1824 | // if not, by testSqlAndScriptInject() only. |
| 1825 | - $sql .= " AND (" . $filter . ")"; |
|
| 1825 | + $sql .= " AND (".$filter.")"; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | // Add where from hooks |
| 1828 | 1828 | $parameters = array(); |
@@ -1830,30 +1830,30 @@ discard block |
||
| 1830 | 1830 | $sql .= $hookmanager->resPrint; |
| 1831 | 1831 | $sql .= " ORDER BY sp.lastname ASC"; |
| 1832 | 1832 | |
| 1833 | - dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
| 1833 | + dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
|
| 1834 | 1834 | $resql = $this->db->query($sql); |
| 1835 | 1835 | if ($resql) { |
| 1836 | 1836 | $num = $this->db->num_rows($resql); |
| 1837 | 1837 | |
| 1838 | 1838 | if ($htmlname != 'none' && !$options_only) { |
| 1839 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
| 1839 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
|
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | 1842 | if ($showempty && !is_numeric($showempty)) { |
| 1843 | 1843 | $textforempty = $showempty; |
| 1844 | - $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
| 1844 | + $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
|
| 1845 | 1845 | } else { |
| 1846 | 1846 | if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
| 1847 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
| 1847 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
|
| 1848 | 1848 | } |
| 1849 | 1849 | if ($showempty == 2) { |
| 1850 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
| 1850 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
|
| 1851 | 1851 | } |
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | $i = 0; |
| 1855 | 1855 | if ($num) { |
| 1856 | - include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 1856 | + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 1857 | 1857 | $contactstatic = new Contact($this->db); |
| 1858 | 1858 | |
| 1859 | 1859 | while ($i < $num) { |
@@ -1889,7 +1889,7 @@ discard block |
||
| 1889 | 1889 | } |
| 1890 | 1890 | $extendedInfos = implode(' - ', $extendedInfos); |
| 1891 | 1891 | if (!empty($extendedInfos)) { |
| 1892 | - $extendedInfos = ' - ' . $extendedInfos; |
|
| 1892 | + $extendedInfos = ' - '.$extendedInfos; |
|
| 1893 | 1893 | } |
| 1894 | 1894 | } |
| 1895 | 1895 | |
@@ -1907,35 +1907,35 @@ discard block |
||
| 1907 | 1907 | $disabled = 1; |
| 1908 | 1908 | } |
| 1909 | 1909 | if (!empty($selected) && in_array($obj->rowid, $selected)) { |
| 1910 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 1910 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 1911 | 1911 | if ($disabled) { |
| 1912 | 1912 | $out .= ' disabled'; |
| 1913 | 1913 | } |
| 1914 | 1914 | $out .= ' selected>'; |
| 1915 | 1915 | |
| 1916 | - $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
| 1916 | + $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
|
| 1917 | 1917 | if ($showfunction && $obj->poste) { |
| 1918 | - $tmplabel .= ' (' . $obj->poste . ')'; |
|
| 1918 | + $tmplabel .= ' ('.$obj->poste.')'; |
|
| 1919 | 1919 | } |
| 1920 | 1920 | if (($showsoc > 0) && $obj->company) { |
| 1921 | - $tmplabel .= ' - (' . $obj->company . ')'; |
|
| 1921 | + $tmplabel .= ' - ('.$obj->company.')'; |
|
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | 1924 | $out .= $tmplabel; |
| 1925 | 1925 | $out .= '</option>'; |
| 1926 | 1926 | } else { |
| 1927 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 1927 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 1928 | 1928 | if ($disabled) { |
| 1929 | 1929 | $out .= ' disabled'; |
| 1930 | 1930 | } |
| 1931 | 1931 | $out .= '>'; |
| 1932 | 1932 | |
| 1933 | - $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
| 1933 | + $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
|
| 1934 | 1934 | if ($showfunction && $obj->poste) { |
| 1935 | - $tmplabel .= ' (' . $obj->poste . ')'; |
|
| 1935 | + $tmplabel .= ' ('.$obj->poste.')'; |
|
| 1936 | 1936 | } |
| 1937 | 1937 | if (($showsoc > 0) && $obj->company) { |
| 1938 | - $tmplabel .= ' - (' . $obj->company . ')'; |
|
| 1938 | + $tmplabel .= ' - ('.$obj->company.')'; |
|
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | 1941 | $out .= $tmplabel; |
@@ -1943,12 +1943,12 @@ discard block |
||
| 1943 | 1943 | } |
| 1944 | 1944 | } else { |
| 1945 | 1945 | if (in_array($obj->rowid, $selected)) { |
| 1946 | - $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
| 1946 | + $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
|
| 1947 | 1947 | if ($showfunction && $obj->poste) { |
| 1948 | - $tmplabel .= ' (' . $obj->poste . ')'; |
|
| 1948 | + $tmplabel .= ' ('.$obj->poste.')'; |
|
| 1949 | 1949 | } |
| 1950 | 1950 | if (($showsoc > 0) && $obj->company) { |
| 1951 | - $tmplabel .= ' - (' . $obj->company . ')'; |
|
| 1951 | + $tmplabel .= ' - ('.$obj->company.')'; |
|
| 1952 | 1952 | } |
| 1953 | 1953 | |
| 1954 | 1954 | $out .= $tmplabel; |
@@ -1963,7 +1963,7 @@ discard block |
||
| 1963 | 1963 | } |
| 1964 | 1964 | } else { |
| 1965 | 1965 | $labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
| 1966 | - $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
| 1966 | + $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
|
| 1967 | 1967 | $out .= $labeltoshow; |
| 1968 | 1968 | $out .= '</option>'; |
| 1969 | 1969 | } |
@@ -1984,7 +1984,7 @@ discard block |
||
| 1984 | 1984 | } |
| 1985 | 1985 | |
| 1986 | 1986 | if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
| 1987 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 1987 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 1988 | 1988 | $out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
| 1989 | 1989 | } |
| 1990 | 1990 | |
@@ -2023,18 +2023,18 @@ discard block |
||
| 2023 | 2023 | // On recherche les remises |
| 2024 | 2024 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
| 2025 | 2025 | $sql .= " re.description, re.fk_facture_source"; |
| 2026 | - $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
|
| 2027 | - $sql .= " WHERE re.fk_soc = " . (int) $socid; |
|
| 2028 | - $sql .= " AND re.entity = " . $conf->entity; |
|
| 2026 | + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
| 2027 | + $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
| 2028 | + $sql .= " AND re.entity = ".$conf->entity; |
|
| 2029 | 2029 | if ($filter) { |
| 2030 | - $sql .= " AND " . $filter; |
|
| 2030 | + $sql .= " AND ".$filter; |
|
| 2031 | 2031 | } |
| 2032 | 2032 | $sql .= " ORDER BY re.description ASC"; |
| 2033 | 2033 | |
| 2034 | - dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
| 2034 | + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
|
| 2035 | 2035 | $resql = $this->db->query($sql); |
| 2036 | 2036 | if ($resql) { |
| 2037 | - print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
| 2037 | + print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
|
| 2038 | 2038 | $num = $this->db->num_rows($resql); |
| 2039 | 2039 | |
| 2040 | 2040 | $qualifiedlines = $num; |
@@ -2072,16 +2072,16 @@ discard block |
||
| 2072 | 2072 | if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
| 2073 | 2073 | $tmpfac = new Facture($this->db); |
| 2074 | 2074 | if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
| 2075 | - $desc = $desc . ' - ' . $tmpfac->ref; |
|
| 2075 | + $desc = $desc.' - '.$tmpfac->ref; |
|
| 2076 | 2076 | } |
| 2077 | 2077 | } |
| 2078 | 2078 | |
| 2079 | - print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
| 2079 | + print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
|
| 2080 | 2080 | $i++; |
| 2081 | 2081 | } |
| 2082 | 2082 | } |
| 2083 | 2083 | print '</select>'; |
| 2084 | - print ajax_combobox('select_' . $htmlname); |
|
| 2084 | + print ajax_combobox('select_'.$htmlname); |
|
| 2085 | 2085 | |
| 2086 | 2086 | return $qualifiedlines; |
| 2087 | 2087 | } else { |
@@ -2190,14 +2190,14 @@ discard block |
||
| 2190 | 2190 | if ($showlabelofentity) { |
| 2191 | 2191 | $sql .= ", e.label"; |
| 2192 | 2192 | } |
| 2193 | - $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
| 2193 | + $sql .= " FROM ".$this->db->prefix()."user as u"; |
|
| 2194 | 2194 | if ($showlabelofentity) { |
| 2195 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
| 2195 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
|
| 2196 | 2196 | } |
| 2197 | 2197 | // Condition here should be the same than into societe->getSalesRepresentatives(). |
| 2198 | 2198 | if ($userissuperadminentityone && $force_entity != 'default') { |
| 2199 | 2199 | if (!empty($force_entity)) { |
| 2200 | - $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
| 2200 | + $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
|
| 2201 | 2201 | } else { |
| 2202 | 2202 | $sql .= " WHERE u.entity IS NOT NULL"; |
| 2203 | 2203 | } |
@@ -2205,18 +2205,18 @@ discard block |
||
| 2205 | 2205 | if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
| 2206 | 2206 | $sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
| 2207 | 2207 | } else { |
| 2208 | - $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
| 2208 | + $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
|
| 2209 | 2209 | } |
| 2210 | 2210 | } |
| 2211 | 2211 | |
| 2212 | 2212 | if (!empty($user->socid)) { |
| 2213 | - $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
| 2213 | + $sql .= " AND u.fk_soc = ".((int) $user->socid); |
|
| 2214 | 2214 | } |
| 2215 | 2215 | if (is_array($exclude) && $excludeUsers) { |
| 2216 | - $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
| 2216 | + $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
|
| 2217 | 2217 | } |
| 2218 | 2218 | if ($includeUsers) { |
| 2219 | - $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
| 2219 | + $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
|
| 2220 | 2220 | } |
| 2221 | 2221 | if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
| 2222 | 2222 | $sql .= " AND u.statut <> 0"; |
@@ -2228,7 +2228,7 @@ discard block |
||
| 2228 | 2228 | $sql .= " AND u.fk_soc IS NULL"; |
| 2229 | 2229 | } |
| 2230 | 2230 | if (!empty($morefilter)) { |
| 2231 | - $sql .= " " . $morefilter; |
|
| 2231 | + $sql .= " ".$morefilter; |
|
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | 2234 | //Add hook to filter on user (for example on usergroup define in custom modules) |
@@ -2243,7 +2243,7 @@ discard block |
||
| 2243 | 2243 | $sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
| 2244 | 2244 | } |
| 2245 | 2245 | |
| 2246 | - dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
| 2246 | + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
|
| 2247 | 2247 | |
| 2248 | 2248 | $resql = $this->db->query($sql); |
| 2249 | 2249 | if ($resql) { |
@@ -2251,7 +2251,7 @@ discard block |
||
| 2251 | 2251 | $i = 0; |
| 2252 | 2252 | if ($num) { |
| 2253 | 2253 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
| 2254 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
| 2254 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
|
| 2255 | 2255 | if ($show_empty && !$multiple) { |
| 2256 | 2256 | $textforempty = ' '; |
| 2257 | 2257 | if (!empty($conf->use_javascript_ajax)) { |
@@ -2260,7 +2260,7 @@ discard block |
||
| 2260 | 2260 | if (!is_numeric($show_empty)) { |
| 2261 | 2261 | $textforempty = $show_empty; |
| 2262 | 2262 | } |
| 2263 | - $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
| 2263 | + $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
|
| 2264 | 2264 | |
| 2265 | 2265 | $outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty; |
| 2266 | 2266 | $outarray2[($show_empty < 0 ? $show_empty : -1)] = array( |
@@ -2272,13 +2272,13 @@ discard block |
||
| 2272 | 2272 | ); |
| 2273 | 2273 | } |
| 2274 | 2274 | if ($show_every) { |
| 2275 | - $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
| 2275 | + $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
|
| 2276 | 2276 | |
| 2277 | - $outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --'; |
|
| 2277 | + $outarray[-2] = '-- '.$langs->trans("Everybody").' --'; |
|
| 2278 | 2278 | $outarray2[-2] = array( |
| 2279 | 2279 | 'id' => -2, |
| 2280 | - 'label' => '-- ' . $langs->trans("Everybody") . ' --', |
|
| 2281 | - 'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --', |
|
| 2280 | + 'label' => '-- '.$langs->trans("Everybody").' --', |
|
| 2281 | + 'labelhtml' => '-- '.$langs->trans("Everybody").' --', |
|
| 2282 | 2282 | 'color' => '', |
| 2283 | 2283 | 'picto' => '' |
| 2284 | 2284 | ); |
@@ -2329,21 +2329,21 @@ discard block |
||
| 2329 | 2329 | } |
| 2330 | 2330 | if ($showstatus >= 0) { |
| 2331 | 2331 | if ($obj->status == 1 && $showstatus == 1) { |
| 2332 | - $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
|
| 2333 | - $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
| 2332 | + $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
| 2333 | + $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
|
| 2334 | 2334 | } |
| 2335 | 2335 | if ($obj->status == 0 && $showstatus == 1) { |
| 2336 | - $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
|
| 2337 | - $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
| 2336 | + $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
| 2337 | + $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
|
| 2338 | 2338 | } |
| 2339 | 2339 | } |
| 2340 | 2340 | if ($showlabelofentity) { |
| 2341 | 2341 | if (empty($obj->entity)) { |
| 2342 | - $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
|
| 2343 | - $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
| 2342 | + $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
| 2343 | + $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
|
| 2344 | 2344 | } else { |
| 2345 | 2345 | if ($obj->entity != $conf->entity) { |
| 2346 | - $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
| 2346 | + $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
| 2347 | 2347 | $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
| 2348 | 2348 | } |
| 2349 | 2349 | } |
@@ -2352,13 +2352,13 @@ discard block |
||
| 2352 | 2352 | $moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
| 2353 | 2353 | if (!empty($disableline) && $disableline != '1') { |
| 2354 | 2354 | // Add text from $enableonlytext parameter |
| 2355 | - $moreinfo .= ' - ' . $disableline; |
|
| 2356 | - $moreinfohtml .= ' - ' . $disableline; |
|
| 2355 | + $moreinfo .= ' - '.$disableline; |
|
| 2356 | + $moreinfohtml .= ' - '.$disableline; |
|
| 2357 | 2357 | } |
| 2358 | 2358 | $labeltoshow .= $moreinfo; |
| 2359 | 2359 | $labeltoshowhtml .= $moreinfohtml; |
| 2360 | 2360 | |
| 2361 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 2361 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 2362 | 2362 | if (!empty($disableline)) { |
| 2363 | 2363 | $out .= ' disabled'; |
| 2364 | 2364 | } |
@@ -2367,7 +2367,7 @@ discard block |
||
| 2367 | 2367 | } |
| 2368 | 2368 | $out .= ' data-html="'; |
| 2369 | 2369 | |
| 2370 | - $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
| 2370 | + $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
|
| 2371 | 2371 | if ($showstatus >= 0 && $obj->status == 0) { |
| 2372 | 2372 | $outhtml .= '<strike class="opacitymediumxxx">'; |
| 2373 | 2373 | } |
@@ -2382,7 +2382,7 @@ discard block |
||
| 2382 | 2382 | $out .= $labeltoshow; |
| 2383 | 2383 | $out .= '</option>'; |
| 2384 | 2384 | |
| 2385 | - $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
| 2385 | + $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
|
| 2386 | 2386 | $outarray2[$userstatic->id] = array( |
| 2387 | 2387 | 'id' => $userstatic->id, |
| 2388 | 2388 | 'label' => $labeltoshow, |
@@ -2394,14 +2394,14 @@ discard block |
||
| 2394 | 2394 | $i++; |
| 2395 | 2395 | } |
| 2396 | 2396 | } else { |
| 2397 | - $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
|
| 2398 | - $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
| 2397 | + $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
| 2398 | + $out .= '<option value="">'.$langs->trans("None").'</option>'; |
|
| 2399 | 2399 | } |
| 2400 | 2400 | $out .= '</select>'; |
| 2401 | 2401 | |
| 2402 | 2402 | if ($num && !$forcecombo) { |
| 2403 | 2403 | // Enhance with select2 |
| 2404 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 2404 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 2405 | 2405 | $out .= ajax_combobox($htmlname); |
| 2406 | 2406 | } |
| 2407 | 2407 | } else { |
@@ -2477,16 +2477,16 @@ discard block |
||
| 2477 | 2477 | $out .= $userstatic->getNomUrl(-1); |
| 2478 | 2478 | if ($i == 0) { |
| 2479 | 2479 | $ownerid = $value['id']; |
| 2480 | - $out .= ' (' . $langs->trans("Owner") . ')'; |
|
| 2480 | + $out .= ' ('.$langs->trans("Owner").')'; |
|
| 2481 | 2481 | } |
| 2482 | 2482 | if ($nbassignetouser > 1 && $action != 'view') { |
| 2483 | - $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">'; |
|
| 2483 | + $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned reposition" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">'; |
|
| 2484 | 2484 | } |
| 2485 | 2485 | // Show my availability |
| 2486 | 2486 | if ($showproperties) { |
| 2487 | 2487 | if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
| 2488 | 2488 | $out .= '<div class="myavailability inline-block">'; |
| 2489 | - $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> </span><input id="transparency" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>'; |
|
| 2489 | + $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>'; |
|
| 2490 | 2490 | $out .= '</div>'; |
| 2491 | 2491 | } |
| 2492 | 2492 | } |
@@ -2503,15 +2503,15 @@ discard block |
||
| 2503 | 2503 | // Method with no ajax |
| 2504 | 2504 | if ($action != 'view') { |
| 2505 | 2505 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
| 2506 | - $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
| 2506 | + $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
|
| 2507 | 2507 | $out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
| 2508 | 2508 | $out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
| 2509 | - $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
|
| 2510 | - $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
| 2509 | + $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
| 2510 | + $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
|
| 2511 | 2511 | $out .= '});'; |
| 2512 | 2512 | $out .= '})</script>'; |
| 2513 | 2513 | $out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
| 2514 | - $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
| 2514 | + $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
|
| 2515 | 2515 | $out .= '<br>'; |
| 2516 | 2516 | } |
| 2517 | 2517 | |
@@ -2570,13 +2570,13 @@ discard block |
||
| 2570 | 2570 | $resourcestatic->fetch($value['id']); |
| 2571 | 2571 | $out .= $resourcestatic->getNomUrl(-1); |
| 2572 | 2572 | if ($nbassignetoresource >= 1 && $action != 'view') { |
| 2573 | - $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassignedresource reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">'; |
|
| 2573 | + $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassignedresource reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">'; |
|
| 2574 | 2574 | } |
| 2575 | 2575 | // Show my availability |
| 2576 | 2576 | if ($showproperties) { |
| 2577 | 2577 | if (is_array($listofresourceid) && count($listofresourceid)) { |
| 2578 | 2578 | $out .= '<div class="myavailability inline-block">'; |
| 2579 | - $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> </span><input id="transparencyresource" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofresourceid[$value['id']]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>'; |
|
| 2579 | + $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparencyresource" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofresourceid[$value['id']]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>'; |
|
| 2580 | 2580 | $out .= '</div>'; |
| 2581 | 2581 | } |
| 2582 | 2582 | } |
@@ -2593,11 +2593,11 @@ discard block |
||
| 2593 | 2593 | // Method with no ajax |
| 2594 | 2594 | if ($action != 'view') { |
| 2595 | 2595 | $out .= '<input type="hidden" class="removedassignedresourcehidden" name="removedassignedresource" value="">'; |
| 2596 | - $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
| 2596 | + $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
|
| 2597 | 2597 | $out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
| 2598 | 2598 | $out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
| 2599 | - $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
|
| 2600 | - $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
| 2599 | + $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
| 2600 | + $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
|
| 2601 | 2601 | $out .= '});'; |
| 2602 | 2602 | $out .= '})</script>'; |
| 2603 | 2603 | |
@@ -2605,7 +2605,7 @@ discard block |
||
| 2605 | 2605 | $out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
| 2606 | 2606 | $out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
| 2607 | 2607 | //$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
| 2608 | - $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
| 2608 | + $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
|
| 2609 | 2609 | $out .= '<br>'; |
| 2610 | 2610 | } |
| 2611 | 2611 | |
@@ -2668,7 +2668,7 @@ discard block |
||
| 2668 | 2668 | $placeholder = (is_numeric($showempty) ? '' : 'placeholder="'.dolPrintHTML($showempty).'"'); |
| 2669 | 2669 | |
| 2670 | 2670 | if ($selected && empty($selected_input_value)) { |
| 2671 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 2671 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 2672 | 2672 | $producttmpselect = new Product($this->db); |
| 2673 | 2673 | $producttmpselect->fetch($selected); |
| 2674 | 2674 | $selected_input_value = $producttmpselect->ref; |
@@ -2683,21 +2683,21 @@ discard block |
||
| 2683 | 2683 | } |
| 2684 | 2684 | } |
| 2685 | 2685 | // mode=1 means customers products |
| 2686 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&status_purchase=' . $status_purchase . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus; |
|
| 2686 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; |
|
| 2687 | 2687 | if ((int) $warehouseId > 0) { |
| 2688 | - $urloption .= '&warehouseid=' . (int) $warehouseId; |
|
| 2688 | + $urloption .= '&warehouseid='.(int) $warehouseId; |
|
| 2689 | 2689 | } |
| 2690 | 2690 | |
| 2691 | - $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); |
|
| 2691 | + $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); |
|
| 2692 | 2692 | |
| 2693 | 2693 | if (isModEnabled('variants') && is_array($selected_combinations)) { |
| 2694 | 2694 | // Code to automatically insert with javascript the select of attributes under the select of product |
| 2695 | 2695 | // when a parent of variant has been selected. |
| 2696 | 2696 | $out .= ' |
| 2697 | 2697 | <!-- script to auto show attributes select tags if a variant was selected --> |
| 2698 | - <script nonce="' . getNonce() . '"> |
|
| 2698 | + <script nonce="' . getNonce().'"> |
|
| 2699 | 2699 | // auto show attributes fields |
| 2700 | - selected = ' . json_encode($selected_combinations) . '; |
|
| 2700 | + selected = ' . json_encode($selected_combinations).'; |
|
| 2701 | 2701 | combvalues = {}; |
| 2702 | 2702 | |
| 2703 | 2703 | jQuery(document).ready(function () { |
@@ -2708,7 +2708,7 @@ discard block |
||
| 2708 | 2708 | } |
| 2709 | 2709 | }); |
| 2710 | 2710 | |
| 2711 | - jQuery("input#' . $htmlname . '").change(function () { |
|
| 2711 | + jQuery("input#' . $htmlname.'").change(function () { |
|
| 2712 | 2712 | |
| 2713 | 2713 | if (!jQuery(this).val()) { |
| 2714 | 2714 | jQuery(\'div#attributes_box\').empty(); |
@@ -2717,7 +2717,7 @@ discard block |
||
| 2717 | 2717 | |
| 2718 | 2718 | console.log("A change has started. We get variants fields to inject html select"); |
| 2719 | 2719 | |
| 2720 | - jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
| 2720 | + jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
|
| 2721 | 2721 | id: jQuery(this).val() |
| 2722 | 2722 | }, function (data) { |
| 2723 | 2723 | jQuery(\'div#attributes_box\').empty(); |
@@ -2760,22 +2760,22 @@ discard block |
||
| 2760 | 2760 | }) |
| 2761 | 2761 | }); |
| 2762 | 2762 | |
| 2763 | - ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
| 2763 | + ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
|
| 2764 | 2764 | }); |
| 2765 | 2765 | </script> |
| 2766 | 2766 | '; |
| 2767 | 2767 | } |
| 2768 | 2768 | |
| 2769 | 2769 | if (empty($hidelabel)) { |
| 2770 | - $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; |
|
| 2770 | + $placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"'; |
|
| 2771 | 2771 | } elseif ($hidelabel > 1) { |
| 2772 | - $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; |
|
| 2772 | + $placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"'; |
|
| 2773 | 2773 | if ($hidelabel == 2) { |
| 2774 | 2774 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 2775 | 2775 | } |
| 2776 | 2776 | } |
| 2777 | 2777 | |
| 2778 | - $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
| 2778 | + $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
|
| 2779 | 2779 | if ($hidelabel == 3) { |
| 2780 | 2780 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 2781 | 2781 | } |
@@ -2812,33 +2812,33 @@ discard block |
||
| 2812 | 2812 | // phpcs:enable |
| 2813 | 2813 | global $db; |
| 2814 | 2814 | |
| 2815 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 2815 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 2816 | 2816 | |
| 2817 | 2817 | $error = 0; |
| 2818 | 2818 | $out = ''; |
| 2819 | 2819 | |
| 2820 | 2820 | if (!$forcecombo) { |
| 2821 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 2821 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 2822 | 2822 | $events = array(); |
| 2823 | 2823 | $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
| 2824 | 2824 | } |
| 2825 | 2825 | |
| 2826 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 2826 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 2827 | 2827 | |
| 2828 | 2828 | $sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
| 2829 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
|
| 2830 | - $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
| 2829 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
| 2830 | + $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
|
| 2831 | 2831 | if (!empty($status)) { |
| 2832 | - $sql .= ' AND status = ' . (int) $status; |
|
| 2832 | + $sql .= ' AND status = '.(int) $status; |
|
| 2833 | 2833 | } |
| 2834 | 2834 | if (!empty($type)) { |
| 2835 | - $sql .= ' AND bomtype = ' . (int) $type; |
|
| 2835 | + $sql .= ' AND bomtype = '.(int) $type; |
|
| 2836 | 2836 | } |
| 2837 | 2837 | if (!empty($TProducts)) { |
| 2838 | - $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
| 2838 | + $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
|
| 2839 | 2839 | } |
| 2840 | 2840 | if (!empty($limit)) { |
| 2841 | - $sql .= ' LIMIT ' . (int) $limit; |
|
| 2841 | + $sql .= ' LIMIT '.(int) $limit; |
|
| 2842 | 2842 | } |
| 2843 | 2843 | $resql = $db->query($sql); |
| 2844 | 2844 | if ($resql) { |
@@ -2852,11 +2852,11 @@ discard block |
||
| 2852 | 2852 | while ($obj = $db->fetch_object($resql)) { |
| 2853 | 2853 | $product = new Product($db); |
| 2854 | 2854 | $res = $product->fetch($obj->fk_product); |
| 2855 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 2855 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 2856 | 2856 | if ($obj->rowid == $selected) { |
| 2857 | 2857 | $out .= 'selected'; |
| 2858 | 2858 | } |
| 2859 | - $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
| 2859 | + $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
|
| 2860 | 2860 | } |
| 2861 | 2861 | } else { |
| 2862 | 2862 | $error++; |
@@ -2914,7 +2914,7 @@ discard block |
||
| 2914 | 2914 | |
| 2915 | 2915 | $warehouseStatusArray = array(); |
| 2916 | 2916 | if (!empty($warehouseStatus)) { |
| 2917 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
| 2917 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
| 2918 | 2918 | if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
| 2919 | 2919 | $warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
| 2920 | 2920 | } |
@@ -2928,9 +2928,9 @@ discard block |
||
| 2928 | 2928 | |
| 2929 | 2929 | $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.duration, p.fk_price_expression"; |
| 2930 | 2930 | if (count($warehouseStatusArray)) { |
| 2931 | - $selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock |
|
| 2931 | + $selectFieldsGrouped = ", sum(".$this->db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock |
|
| 2932 | 2932 | } else { |
| 2933 | - $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
| 2933 | + $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
|
| 2934 | 2934 | } |
| 2935 | 2935 | |
| 2936 | 2936 | $sql = "SELECT "; |
@@ -2946,9 +2946,9 @@ discard block |
||
| 2946 | 2946 | |
| 2947 | 2947 | if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
| 2948 | 2948 | //Product category |
| 2949 | - $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
|
| 2950 | - FROM " . $this->db->prefix() . "categorie_product |
|
| 2951 | - WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
| 2949 | + $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
| 2950 | + FROM " . $this->db->prefix()."categorie_product |
|
| 2951 | + WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
|
| 2952 | 2952 | LIMIT 1 |
| 2953 | 2953 | ) AS categorie_product_id "; |
| 2954 | 2954 | } |
@@ -2974,15 +2974,15 @@ discard block |
||
| 2974 | 2974 | } |
| 2975 | 2975 | // Price by quantity |
| 2976 | 2976 | if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
| 2977 | - $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
| 2977 | + $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
|
| 2978 | 2978 | if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
| 2979 | - $sql .= " AND price_level = " . ((int) $price_level); |
|
| 2979 | + $sql .= " AND price_level = ".((int) $price_level); |
|
| 2980 | 2980 | } |
| 2981 | 2981 | $sql .= " ORDER BY date_price"; |
| 2982 | 2982 | $sql .= " DESC LIMIT 1) as price_rowid"; |
| 2983 | - $sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
|
| 2983 | + $sql .= ", (SELECT pp.price_by_qty FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
|
| 2984 | 2984 | if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
| 2985 | - $sql .= " AND price_level = " . ((int) $price_level); |
|
| 2985 | + $sql .= " AND price_level = ".((int) $price_level); |
|
| 2986 | 2986 | } |
| 2987 | 2987 | $sql .= " ORDER BY date_price"; |
| 2988 | 2988 | $sql .= " DESC LIMIT 1) as price_by_qty"; |
@@ -2992,7 +2992,7 @@ discard block |
||
| 2992 | 2992 | $sql .= " FROM ".$this->db->prefix()."product as p"; |
| 2993 | 2993 | |
| 2994 | 2994 | if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { |
| 2995 | - $sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; |
|
| 2995 | + $sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; |
|
| 2996 | 2996 | } |
| 2997 | 2997 | |
| 2998 | 2998 | // Add from (left join) from hooks |
@@ -3001,53 +3001,53 @@ discard block |
||
| 3001 | 3001 | $sql .= $hookmanager->resPrint; |
| 3002 | 3002 | |
| 3003 | 3003 | if (count($warehouseStatusArray)) { |
| 3004 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
|
| 3005 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
|
| 3006 | - $sql .= ' AND e.statut IN (' . $this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))) . ')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0. |
|
| 3004 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
| 3005 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
| 3006 | + $sql .= ' AND e.statut IN ('.$this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0. |
|
| 3007 | 3007 | } |
| 3008 | 3008 | |
| 3009 | 3009 | // include search in supplier ref |
| 3010 | 3010 | if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
| 3011 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
| 3011 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
| 3012 | 3012 | } |
| 3013 | 3013 | |
| 3014 | 3014 | //Price by customer |
| 3015 | 3015 | if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { |
| 3016 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
| 3016 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
|
| 3017 | 3017 | } |
| 3018 | 3018 | // Units |
| 3019 | 3019 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
| 3020 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
| 3020 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
|
| 3021 | 3021 | } |
| 3022 | 3022 | // Multilang : we add translation |
| 3023 | 3023 | if (getDolGlobalInt('MAIN_MULTILANGS')) { |
| 3024 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
| 3024 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
|
| 3025 | 3025 | if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
| 3026 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 3026 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 3027 | 3027 | $soc = new Societe($this->db); |
| 3028 | 3028 | $result = $soc->fetch($socid); |
| 3029 | 3029 | if ($result > 0 && !empty($soc->default_lang)) { |
| 3030 | - $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
| 3030 | + $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
|
| 3031 | 3031 | } else { |
| 3032 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
| 3032 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
|
| 3033 | 3033 | } |
| 3034 | 3034 | } else { |
| 3035 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
| 3035 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
|
| 3036 | 3036 | } |
| 3037 | 3037 | } |
| 3038 | 3038 | |
| 3039 | 3039 | if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
| 3040 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
| 3040 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
| 3041 | 3041 | } |
| 3042 | 3042 | |
| 3043 | - $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
| 3043 | + $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
|
| 3044 | 3044 | |
| 3045 | 3045 | if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
| 3046 | 3046 | $sql .= " AND pac.rowid IS NULL"; |
| 3047 | 3047 | } |
| 3048 | 3048 | |
| 3049 | 3049 | if ($finished == 0) { |
| 3050 | - $sql .= " AND p.finished = " . ((int) $finished); |
|
| 3050 | + $sql .= " AND p.finished = ".((int) $finished); |
|
| 3051 | 3051 | } elseif ($finished == 1) { |
| 3052 | 3052 | $sql .= " AND p.finished = ".((int) $finished); |
| 3053 | 3053 | } |
@@ -3055,11 +3055,11 @@ discard block |
||
| 3055 | 3055 | $sql .= " AND p.tosell = ".((int) $status); |
| 3056 | 3056 | } |
| 3057 | 3057 | if ($status_purchase >= 0) { |
| 3058 | - $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
| 3058 | + $sql .= " AND p.tobuy = ".((int) $status_purchase); |
|
| 3059 | 3059 | } |
| 3060 | 3060 | // Filter by product type |
| 3061 | 3061 | if (strval($filtertype) != '') { |
| 3062 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
| 3062 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
|
| 3063 | 3063 | } elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
| 3064 | 3064 | $sql .= " AND p.fk_product_type = 1"; |
| 3065 | 3065 | } elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
@@ -3067,7 +3067,7 @@ discard block |
||
| 3067 | 3067 | } |
| 3068 | 3068 | |
| 3069 | 3069 | if ((int) $warehouseId > 0) { |
| 3070 | - $sql .= " AND EXISTS (SELECT psw.fk_product FROM " . $this->db->prefix() . "product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)"; |
|
| 3070 | + $sql .= " AND EXISTS (SELECT psw.fk_product FROM ".$this->db->prefix()."product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)"; |
|
| 3071 | 3071 | } |
| 3072 | 3072 | |
| 3073 | 3073 | // Add where from hooks |
@@ -3088,21 +3088,21 @@ discard block |
||
| 3088 | 3088 | if ($i > 0) { |
| 3089 | 3089 | $sql .= " AND "; |
| 3090 | 3090 | } |
| 3091 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3091 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3092 | 3092 | if (getDolGlobalInt('MAIN_MULTILANGS')) { |
| 3093 | - $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3093 | + $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3094 | 3094 | } |
| 3095 | 3095 | if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { |
| 3096 | - $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3096 | + $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3097 | 3097 | } |
| 3098 | 3098 | if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
| 3099 | - $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3099 | + $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3100 | 3100 | if (getDolGlobalInt('MAIN_MULTILANGS')) { |
| 3101 | - $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3101 | + $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3102 | 3102 | } |
| 3103 | 3103 | } |
| 3104 | 3104 | if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
| 3105 | - $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3105 | + $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3106 | 3106 | } |
| 3107 | 3107 | $sql .= ")"; |
| 3108 | 3108 | $i++; |
@@ -3111,12 +3111,12 @@ discard block |
||
| 3111 | 3111 | $sql .= ")"; |
| 3112 | 3112 | } |
| 3113 | 3113 | if (isModEnabled('barcode')) { |
| 3114 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
| 3114 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
| 3115 | 3115 | } |
| 3116 | 3116 | $sql .= ')'; |
| 3117 | 3117 | } |
| 3118 | 3118 | if (count($warehouseStatusArray)) { |
| 3119 | - $sql .= " GROUP BY " . $selectFields; |
|
| 3119 | + $sql .= " GROUP BY ".$selectFields; |
|
| 3120 | 3120 | } |
| 3121 | 3121 | |
| 3122 | 3122 | //Sort by category |
@@ -3131,23 +3131,23 @@ discard block |
||
| 3131 | 3131 | $sql .= $this->db->plimit($limit, 0); |
| 3132 | 3132 | |
| 3133 | 3133 | // Build output string |
| 3134 | - dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
| 3134 | + dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
|
| 3135 | 3135 | $result = $this->db->query($sql); |
| 3136 | 3136 | if ($result) { |
| 3137 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 3138 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
| 3139 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
| 3137 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 3138 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
| 3139 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
|
| 3140 | 3140 | |
| 3141 | 3141 | $num = $this->db->num_rows($result); |
| 3142 | 3142 | |
| 3143 | 3143 | $events = array(); |
| 3144 | 3144 | |
| 3145 | 3145 | if (!$forcecombo) { |
| 3146 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 3146 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 3147 | 3147 | $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
| 3148 | 3148 | } |
| 3149 | 3149 | |
| 3150 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 3150 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 3151 | 3151 | |
| 3152 | 3152 | $textifempty = ''; |
| 3153 | 3153 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
@@ -3164,7 +3164,7 @@ discard block |
||
| 3164 | 3164 | } |
| 3165 | 3165 | } |
| 3166 | 3166 | if ($showempty) { |
| 3167 | - $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
| 3167 | + $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
|
| 3168 | 3168 | } |
| 3169 | 3169 | |
| 3170 | 3170 | $i = 0; |
@@ -3175,11 +3175,11 @@ discard block |
||
| 3175 | 3175 | |
| 3176 | 3176 | if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product |
| 3177 | 3177 | $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
| 3178 | - $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
|
| 3179 | - $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
| 3178 | + $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
| 3179 | + $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
|
| 3180 | 3180 | $sql .= " ORDER BY quantity ASC"; |
| 3181 | 3181 | |
| 3182 | - dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
| 3182 | + dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
|
| 3183 | 3183 | $result2 = $this->db->query($sql); |
| 3184 | 3184 | if ($result2) { |
| 3185 | 3185 | $nb_prices = $this->db->num_rows($result2); |
@@ -3217,7 +3217,7 @@ discard block |
||
| 3217 | 3217 | $price_product = new Product($this->db); |
| 3218 | 3218 | $price_product->fetch($objp->rowid, '', '', 1); |
| 3219 | 3219 | |
| 3220 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
| 3220 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
| 3221 | 3221 | $priceparser = new PriceParser($this->db); |
| 3222 | 3222 | $price_result = $priceparser->parseProduct($price_product); |
| 3223 | 3223 | if ($price_result >= 0) { |
@@ -3303,7 +3303,7 @@ discard block |
||
| 3303 | 3303 | $label = $objp->label_translated; |
| 3304 | 3304 | } |
| 3305 | 3305 | if (!empty($filterkey) && $filterkey != '') { |
| 3306 | - $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
| 3306 | + $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
|
| 3307 | 3307 | } |
| 3308 | 3308 | |
| 3309 | 3309 | $outkey = $objp->rowid; |
@@ -3324,32 +3324,32 @@ discard block |
||
| 3324 | 3324 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
| 3325 | 3325 | |
| 3326 | 3326 | if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
| 3327 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
| 3327 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
| 3328 | 3328 | } |
| 3329 | 3329 | |
| 3330 | 3330 | // Units |
| 3331 | 3331 | $outvalUnits = ''; |
| 3332 | 3332 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
| 3333 | 3333 | if (!empty($objp->unit_short)) { |
| 3334 | - $outvalUnits .= ' - ' . $objp->unit_short; |
|
| 3334 | + $outvalUnits .= ' - '.$objp->unit_short; |
|
| 3335 | 3335 | } |
| 3336 | 3336 | } |
| 3337 | 3337 | if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
| 3338 | 3338 | if (!empty($objp->weight) && $objp->weight_units !== null) { |
| 3339 | 3339 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
| 3340 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3340 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3341 | 3341 | } |
| 3342 | 3342 | if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
| 3343 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
|
| 3344 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3343 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
| 3344 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3345 | 3345 | } |
| 3346 | 3346 | if (!empty($objp->surface) && $objp->surface_units !== null) { |
| 3347 | 3347 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
| 3348 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3348 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3349 | 3349 | } |
| 3350 | 3350 | if (!empty($objp->volume) && $objp->volume_units !== null) { |
| 3351 | 3351 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
| 3352 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3352 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3353 | 3353 | } |
| 3354 | 3354 | } |
| 3355 | 3355 | if ($outdurationvalue && $outdurationunit) { |
@@ -3361,7 +3361,7 @@ discard block |
||
| 3361 | 3361 | 'y' => $langs->trans('Year') |
| 3362 | 3362 | ); |
| 3363 | 3363 | if (isset($da[$outdurationunit])) { |
| 3364 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
| 3364 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
|
| 3365 | 3365 | } |
| 3366 | 3366 | } |
| 3367 | 3367 | |
@@ -3381,31 +3381,31 @@ discard block |
||
| 3381 | 3381 | $labeltoshow = ''; |
| 3382 | 3382 | $labeltoshow .= $objp->ref; |
| 3383 | 3383 | if (!empty($objp->custref)) { |
| 3384 | - $labeltoshow .= ' (' . $objp->custref . ')'; |
|
| 3384 | + $labeltoshow .= ' ('.$objp->custref.')'; |
|
| 3385 | 3385 | } |
| 3386 | 3386 | if ($outbarcode) { |
| 3387 | - $labeltoshow .= ' (' . $outbarcode . ')'; |
|
| 3387 | + $labeltoshow .= ' ('.$outbarcode.')'; |
|
| 3388 | 3388 | } |
| 3389 | - $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
| 3389 | + $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); |
|
| 3390 | 3390 | if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
| 3391 | - $labeltoshow .= ' (' . getCountry($outorigin, '1') . ')'; |
|
| 3391 | + $labeltoshow .= ' ('.getCountry($outorigin, '1').')'; |
|
| 3392 | 3392 | } |
| 3393 | 3393 | |
| 3394 | 3394 | // Set $labltoshowhtml |
| 3395 | 3395 | $labeltoshowhtml = ''; |
| 3396 | 3396 | $labeltoshowhtml .= $objp->ref; |
| 3397 | 3397 | if (!empty($objp->custref)) { |
| 3398 | - $labeltoshowhtml .= ' (' . $objp->custref . ')'; |
|
| 3398 | + $labeltoshowhtml .= ' ('.$objp->custref.')'; |
|
| 3399 | 3399 | } |
| 3400 | 3400 | if (!empty($filterkey) && $filterkey != '') { |
| 3401 | - $labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
| 3401 | + $labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
| 3402 | 3402 | } |
| 3403 | 3403 | if ($outbarcode) { |
| 3404 | - $labeltoshowhtml .= ' (' . $outbarcode . ')'; |
|
| 3404 | + $labeltoshowhtml .= ' ('.$outbarcode.')'; |
|
| 3405 | 3405 | } |
| 3406 | - $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
| 3406 | + $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); |
|
| 3407 | 3407 | if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
| 3408 | - $labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')'; |
|
| 3408 | + $labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')'; |
|
| 3409 | 3409 | } |
| 3410 | 3410 | |
| 3411 | 3411 | // Stock |
@@ -3413,14 +3413,14 @@ discard block |
||
| 3413 | 3413 | $labeltoshowhtmlstock = ''; |
| 3414 | 3414 | if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
| 3415 | 3415 | if ($user->hasRight('stock', 'lire')) { |
| 3416 | - $labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
| 3416 | + $labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
| 3417 | 3417 | |
| 3418 | 3418 | if ($objp->stock > 0) { |
| 3419 | 3419 | $labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; |
| 3420 | 3420 | } elseif ($objp->stock <= 0) { |
| 3421 | 3421 | $labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; |
| 3422 | 3422 | } |
| 3423 | - $labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
| 3423 | + $labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
| 3424 | 3424 | $labeltoshowhtmlstock .= '</span>'; |
| 3425 | 3425 | |
| 3426 | 3426 | if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
@@ -3431,9 +3431,9 @@ discard block |
||
| 3431 | 3431 | $tmpproduct->load_virtual_stock(); |
| 3432 | 3432 | $virtualstock = $tmpproduct->stock_theorique; |
| 3433 | 3433 | |
| 3434 | - $labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
| 3434 | + $labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
|
| 3435 | 3435 | |
| 3436 | - $labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
| 3436 | + $labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; |
|
| 3437 | 3437 | if ($virtualstock > 0) { |
| 3438 | 3438 | $labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; |
| 3439 | 3439 | } elseif ($virtualstock <= 0) { |
@@ -3454,35 +3454,35 @@ discard block |
||
| 3454 | 3454 | // If we need a particular price level (from 1 to n) |
| 3455 | 3455 | if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { |
| 3456 | 3456 | $sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
| 3457 | - $sql .= " FROM " . $this->db->prefix() . "product_price"; |
|
| 3458 | - $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
|
| 3459 | - $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
|
| 3460 | - $sql .= " AND price_level = " . ((int) $price_level); |
|
| 3457 | + $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
| 3458 | + $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
| 3459 | + $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
| 3460 | + $sql .= " AND price_level = ".((int) $price_level); |
|
| 3461 | 3461 | $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
| 3462 | 3462 | $sql .= " LIMIT 1"; |
| 3463 | 3463 | |
| 3464 | - dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
| 3464 | + dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
|
| 3465 | 3465 | $result2 = $this->db->query($sql); |
| 3466 | 3466 | if ($result2) { |
| 3467 | 3467 | $objp2 = $this->db->fetch_object($result2); |
| 3468 | 3468 | if ($objp2) { |
| 3469 | 3469 | $found = 1; |
| 3470 | 3470 | if ($objp2->price_base_type == 'HT') { |
| 3471 | - $labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
|
| 3472 | - $labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
| 3471 | + $labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
| 3472 | + $labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
|
| 3473 | 3473 | } else { |
| 3474 | - $labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
|
| 3475 | - $labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
| 3474 | + $labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
| 3475 | + $labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
|
| 3476 | 3476 | } |
| 3477 | 3477 | $outprice_ht = price($objp2->price); |
| 3478 | 3478 | $outprice_ttc = price($objp2->price_ttc); |
| 3479 | 3479 | $outpricebasetype = $objp2->price_base_type; |
| 3480 | 3480 | if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
| 3481 | - $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
| 3482 | - $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
| 3481 | + $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
| 3482 | + $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
| 3483 | 3483 | } else { |
| 3484 | - $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
| 3485 | - $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
| 3484 | + $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
| 3485 | + $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
| 3486 | 3486 | } |
| 3487 | 3487 | } |
| 3488 | 3488 | } else { |
@@ -3496,13 +3496,13 @@ discard block |
||
| 3496 | 3496 | $outqty = $objp->quantity; |
| 3497 | 3497 | $outdiscount = $objp->remise_percent; |
| 3498 | 3498 | if ($objp->quantity == 1) { |
| 3499 | - $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
| 3500 | - $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
| 3499 | + $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
| 3500 | + $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
|
| 3501 | 3501 | $labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
| 3502 | 3502 | $labeltoshowhtmlprice .= $langs->transnoentities("Unit"); |
| 3503 | 3503 | } else { |
| 3504 | - $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
| 3505 | - $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
| 3504 | + $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
| 3505 | + $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
| 3506 | 3506 | $labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
| 3507 | 3507 | $labeltoshowhtmlprice .= $langs->transnoentities("Units"); |
| 3508 | 3508 | } |
@@ -3510,16 +3510,16 @@ discard block |
||
| 3510 | 3510 | $outprice_ht = price($objp->unitprice); |
| 3511 | 3511 | $outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
| 3512 | 3512 | $outpricebasetype = $objp->price_base_type; |
| 3513 | - $outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
|
| 3514 | - $outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
|
| 3513 | + $outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
|
| 3514 | + $outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
|
| 3515 | 3515 | } |
| 3516 | 3516 | if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
| 3517 | - $labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3518 | - $labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3517 | + $labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3518 | + $labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3519 | 3519 | } |
| 3520 | 3520 | if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
| 3521 | - $labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
| 3522 | - $labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
| 3521 | + $labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
| 3522 | + $labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
| 3523 | 3523 | } |
| 3524 | 3524 | |
| 3525 | 3525 | // Price by customer |
@@ -3528,11 +3528,11 @@ discard block |
||
| 3528 | 3528 | $found = 1; |
| 3529 | 3529 | |
| 3530 | 3530 | if ($objp->custprice_base_type == 'HT') { |
| 3531 | - $labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
|
| 3532 | - $labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
| 3531 | + $labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
| 3532 | + $labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
|
| 3533 | 3533 | } else { |
| 3534 | - $labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
|
| 3535 | - $labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
| 3534 | + $labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
| 3535 | + $labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
|
| 3536 | 3536 | } |
| 3537 | 3537 | |
| 3538 | 3538 | $outprice_ht = price($objp->custprice); |
@@ -3546,11 +3546,11 @@ discard block |
||
| 3546 | 3546 | // If level no defined or multiprice not found, we used the default price |
| 3547 | 3547 | if (empty($hidepriceinlabel) && !$found) { |
| 3548 | 3548 | if ($objp->price_base_type == 'HT') { |
| 3549 | - $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
|
| 3550 | - $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
| 3549 | + $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
| 3550 | + $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
|
| 3551 | 3551 | } else { |
| 3552 | - $labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
|
| 3553 | - $labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
| 3552 | + $labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
| 3553 | + $labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
|
| 3554 | 3554 | } |
| 3555 | 3555 | $outprice_ht = price($objp->price); |
| 3556 | 3556 | $outprice_ttc = price($objp->price_ttc); |
@@ -3560,14 +3560,14 @@ discard block |
||
| 3560 | 3560 | } |
| 3561 | 3561 | |
| 3562 | 3562 | // Build options |
| 3563 | - $opt = '<option value="' . $objp->rowid . '"'; |
|
| 3563 | + $opt = '<option value="'.$objp->rowid.'"'; |
|
| 3564 | 3564 | $opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
| 3565 | 3565 | if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
| 3566 | - $opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqup="' . $objp->price_by_qty_unitprice . '" data-pbqbase="' . $objp->price_by_qty_price_base_type . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"'; |
|
| 3566 | + $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; |
|
| 3567 | 3567 | } |
| 3568 | 3568 | if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
| 3569 | - $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
|
| 3570 | - $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
| 3569 | + $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
| 3570 | + $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
|
| 3571 | 3571 | } |
| 3572 | 3572 | |
| 3573 | 3573 | if ($stocktag == 1) { |
@@ -3662,7 +3662,7 @@ discard block |
||
| 3662 | 3662 | $selected_input_value = ''; |
| 3663 | 3663 | if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
| 3664 | 3664 | if ($selected > 0) { |
| 3665 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 3665 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 3666 | 3666 | $producttmpselect = new Product($this->db); |
| 3667 | 3667 | $producttmpselect->fetch($selected); |
| 3668 | 3668 | $selected_input_value = $producttmpselect->ref; |
@@ -3670,10 +3670,10 @@ discard block |
||
| 3670 | 3670 | } |
| 3671 | 3671 | |
| 3672 | 3672 | // mode=2 means suppliers products |
| 3673 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
|
| 3674 | - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
| 3673 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
| 3674 | + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
| 3675 | 3675 | |
| 3676 | - print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
| 3676 | + print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
|
| 3677 | 3677 | } else { |
| 3678 | 3678 | print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
| 3679 | 3679 | } |
@@ -3731,25 +3731,25 @@ discard block |
||
| 3731 | 3731 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
| 3732 | 3732 | $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units"; |
| 3733 | 3733 | } |
| 3734 | - $sql .= " FROM " . $this->db->prefix() . "product as p"; |
|
| 3735 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
| 3734 | + $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
| 3735 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
|
| 3736 | 3736 | if ($socid > 0) { |
| 3737 | - $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
| 3737 | + $sql .= " AND pfp.fk_soc = ".((int) $socid); |
|
| 3738 | 3738 | } |
| 3739 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
| 3739 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
| 3740 | 3740 | // Units |
| 3741 | 3741 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
| 3742 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
| 3742 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
|
| 3743 | 3743 | } |
| 3744 | - $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
| 3744 | + $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
|
| 3745 | 3745 | if ($statut != -1) { |
| 3746 | - $sql .= " AND p.tobuy = " . ((int) $statut); |
|
| 3746 | + $sql .= " AND p.tobuy = ".((int) $statut); |
|
| 3747 | 3747 | } |
| 3748 | 3748 | if (strval($filtertype) != '') { |
| 3749 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
| 3749 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
|
| 3750 | 3750 | } |
| 3751 | 3751 | if (!empty($filtre)) { |
| 3752 | - $sql .= " " . $filtre; |
|
| 3752 | + $sql .= " ".$filtre; |
|
| 3753 | 3753 | } |
| 3754 | 3754 | // Add where from hooks |
| 3755 | 3755 | $parameters = array(); |
@@ -3769,9 +3769,9 @@ discard block |
||
| 3769 | 3769 | if ($i > 0) { |
| 3770 | 3770 | $sql .= " AND "; |
| 3771 | 3771 | } |
| 3772 | - $sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3772 | + $sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3773 | 3773 | if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
| 3774 | - $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 3774 | + $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 3775 | 3775 | } |
| 3776 | 3776 | $sql .= ")"; |
| 3777 | 3777 | $i++; |
@@ -3780,8 +3780,8 @@ discard block |
||
| 3780 | 3780 | $sql .= ")"; |
| 3781 | 3781 | } |
| 3782 | 3782 | if (isModEnabled('barcode')) { |
| 3783 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
| 3784 | - $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
| 3783 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
| 3784 | + $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
| 3785 | 3785 | } |
| 3786 | 3786 | $sql .= ')'; |
| 3787 | 3787 | } |
@@ -3790,20 +3790,20 @@ discard block |
||
| 3790 | 3790 | |
| 3791 | 3791 | // Build output string |
| 3792 | 3792 | |
| 3793 | - dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
| 3793 | + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
|
| 3794 | 3794 | $result = $this->db->query($sql); |
| 3795 | 3795 | if ($result) { |
| 3796 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
| 3797 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
| 3796 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
| 3797 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
|
| 3798 | 3798 | |
| 3799 | 3799 | $num = $this->db->num_rows($result); |
| 3800 | 3800 | |
| 3801 | 3801 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
| 3802 | - $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 3802 | + $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 3803 | 3803 | if (!$selected) { |
| 3804 | - $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
| 3804 | + $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
|
| 3805 | 3805 | } else { |
| 3806 | - $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
| 3806 | + $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
|
| 3807 | 3807 | } |
| 3808 | 3808 | |
| 3809 | 3809 | $i = 0; |
@@ -3818,7 +3818,7 @@ discard block |
||
| 3818 | 3818 | |
| 3819 | 3819 | $outkey = $objp->idprodfournprice; // id in table of price |
| 3820 | 3820 | if (!$outkey && $alsoproductwithnosupplierprice) { |
| 3821 | - $outkey = 'idprod_' . $objp->rowid; // id of product |
|
| 3821 | + $outkey = 'idprod_'.$objp->rowid; // id of product |
|
| 3822 | 3822 | } |
| 3823 | 3823 | |
| 3824 | 3824 | $outref = $objp->ref; |
@@ -3833,23 +3833,23 @@ discard block |
||
| 3833 | 3833 | $outvalUnits = ''; |
| 3834 | 3834 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
| 3835 | 3835 | if (!empty($objp->unit_short)) { |
| 3836 | - $outvalUnits .= ' - ' . $objp->unit_short; |
|
| 3836 | + $outvalUnits .= ' - '.$objp->unit_short; |
|
| 3837 | 3837 | } |
| 3838 | 3838 | if (!empty($objp->weight) && $objp->weight_units !== null) { |
| 3839 | 3839 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
| 3840 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3840 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3841 | 3841 | } |
| 3842 | 3842 | if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
| 3843 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
|
| 3844 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3843 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
| 3844 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3845 | 3845 | } |
| 3846 | 3846 | if (!empty($objp->surface) && $objp->surface_units !== null) { |
| 3847 | 3847 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
| 3848 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3848 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3849 | 3849 | } |
| 3850 | 3850 | if (!empty($objp->volume) && $objp->volume_units !== null) { |
| 3851 | 3851 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
| 3852 | - $outvalUnits .= ' - ' . $unitToShow; |
|
| 3852 | + $outvalUnits .= ' - '.$unitToShow; |
|
| 3853 | 3853 | } |
| 3854 | 3854 | if ($outdurationvalue && $outdurationunit) { |
| 3855 | 3855 | $da = array( |
@@ -3860,22 +3860,22 @@ discard block |
||
| 3860 | 3860 | 'y' => $langs->trans('Year') |
| 3861 | 3861 | ); |
| 3862 | 3862 | if (isset($da[$outdurationunit])) { |
| 3863 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
| 3863 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
|
| 3864 | 3864 | } |
| 3865 | 3865 | } |
| 3866 | 3866 | } |
| 3867 | 3867 | |
| 3868 | 3868 | $objRef = $objp->ref; |
| 3869 | 3869 | if ($filterkey && $filterkey != '') { |
| 3870 | - $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
| 3870 | + $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
|
| 3871 | 3871 | } |
| 3872 | 3872 | $objRefFourn = $objp->ref_fourn; |
| 3873 | 3873 | if ($filterkey && $filterkey != '') { |
| 3874 | - $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
| 3874 | + $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
| 3875 | 3875 | } |
| 3876 | 3876 | $label = $objp->label; |
| 3877 | 3877 | if ($filterkey && $filterkey != '') { |
| 3878 | - $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
| 3878 | + $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
|
| 3879 | 3879 | } |
| 3880 | 3880 | |
| 3881 | 3881 | switch ($objp->fk_product_type) { |
@@ -3898,21 +3898,21 @@ discard block |
||
| 3898 | 3898 | |
| 3899 | 3899 | $optlabel .= $objp->ref; |
| 3900 | 3900 | if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
| 3901 | - $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
| 3901 | + $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
|
| 3902 | 3902 | } |
| 3903 | 3903 | if (isModEnabled('barcode') && !empty($objp->barcode)) { |
| 3904 | - $optlabel .= ' (' . $outbarcode . ')'; |
|
| 3904 | + $optlabel .= ' ('.$outbarcode.')'; |
|
| 3905 | 3905 | } |
| 3906 | - $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
| 3906 | + $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
|
| 3907 | 3907 | |
| 3908 | 3908 | $outvallabel = $objRef; |
| 3909 | 3909 | if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
| 3910 | - $outvallabel .= ' (' . $objRefFourn . ')'; |
|
| 3910 | + $outvallabel .= ' ('.$objRefFourn.')'; |
|
| 3911 | 3911 | } |
| 3912 | 3912 | if (isModEnabled('barcode') && !empty($objp->barcode)) { |
| 3913 | - $outvallabel .= ' (' . $outbarcode . ')'; |
|
| 3913 | + $outvallabel .= ' ('.$outbarcode.')'; |
|
| 3914 | 3914 | } |
| 3915 | - $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
| 3915 | + $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
|
| 3916 | 3916 | |
| 3917 | 3917 | // Units |
| 3918 | 3918 | $optlabel .= $outvalUnits; |
@@ -3929,7 +3929,7 @@ discard block |
||
| 3929 | 3929 | $prod_supplier->fourn_tva_tx = $objp->tva_tx; |
| 3930 | 3930 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
| 3931 | 3931 | |
| 3932 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
| 3932 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
| 3933 | 3933 | $priceparser = new PriceParser($this->db); |
| 3934 | 3934 | $price_result = $priceparser->parseProductSupplier($prod_supplier); |
| 3935 | 3935 | if ($price_result >= 0) { |
@@ -3940,57 +3940,57 @@ discard block |
||
| 3940 | 3940 | } |
| 3941 | 3941 | } |
| 3942 | 3942 | if ($objp->quantity == 1) { |
| 3943 | - $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
| 3944 | - $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
| 3943 | + $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
| 3944 | + $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
|
| 3945 | 3945 | $optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
| 3946 | 3946 | $outvallabel .= $langs->transnoentities("Unit"); |
| 3947 | 3947 | } else { |
| 3948 | - $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
| 3949 | - $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
| 3950 | - $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
| 3951 | - $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
| 3948 | + $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
| 3949 | + $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
| 3950 | + $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
| 3951 | + $outvallabel .= ' '.$langs->transnoentities("Units"); |
|
| 3952 | 3952 | } |
| 3953 | 3953 | |
| 3954 | 3954 | if ($objp->quantity > 1) { |
| 3955 | - $optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3956 | - $outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3955 | + $optlabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3956 | + $outvallabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
| 3957 | 3957 | } |
| 3958 | 3958 | if ($objp->remise_percent >= 1) { |
| 3959 | - $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
| 3960 | - $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
| 3959 | + $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
| 3960 | + $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
| 3961 | 3961 | } |
| 3962 | 3962 | if ($objp->duration) { |
| 3963 | - $optlabel .= " - " . $objp->duration; |
|
| 3964 | - $outvallabel .= " - " . $objp->duration; |
|
| 3963 | + $optlabel .= " - ".$objp->duration; |
|
| 3964 | + $outvallabel .= " - ".$objp->duration; |
|
| 3965 | 3965 | } |
| 3966 | 3966 | if (!$socid) { |
| 3967 | - $optlabel .= " - " . dol_trunc($objp->name, 8); |
|
| 3968 | - $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
| 3967 | + $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
| 3968 | + $outvallabel .= " - ".dol_trunc($objp->name, 8); |
|
| 3969 | 3969 | } |
| 3970 | 3970 | if ($objp->supplier_reputation) { |
| 3971 | 3971 | //TODO dictionary |
| 3972 | 3972 | $reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
| 3973 | 3973 | |
| 3974 | - $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
| 3975 | - $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
| 3974 | + $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
| 3975 | + $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
| 3976 | 3976 | } |
| 3977 | 3977 | } else { |
| 3978 | - $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
|
| 3979 | - $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
| 3978 | + $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
| 3979 | + $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
| 3980 | 3980 | } |
| 3981 | 3981 | |
| 3982 | 3982 | if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
| 3983 | 3983 | $novirtualstock = ($showstockinlist == 2); |
| 3984 | 3984 | |
| 3985 | 3985 | if ($user->hasRight('stock', 'lire')) { |
| 3986 | - $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
| 3986 | + $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
| 3987 | 3987 | |
| 3988 | 3988 | if ($objp->stock > 0) { |
| 3989 | 3989 | $optlabel .= ' - <span class="product_line_stock_ok">'; |
| 3990 | 3990 | } elseif ($objp->stock <= 0) { |
| 3991 | 3991 | $optlabel .= ' - <span class="product_line_stock_too_low">'; |
| 3992 | 3992 | } |
| 3993 | - $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
| 3993 | + $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
|
| 3994 | 3994 | $optlabel .= '</span>'; |
| 3995 | 3995 | if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
| 3996 | 3996 | $langs->load("stocks"); |
@@ -4000,9 +4000,9 @@ discard block |
||
| 4000 | 4000 | $tmpproduct->load_virtual_stock(); |
| 4001 | 4001 | $virtualstock = $tmpproduct->stock_theorique; |
| 4002 | 4002 | |
| 4003 | - $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
| 4003 | + $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
|
| 4004 | 4004 | |
| 4005 | - $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
| 4005 | + $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
|
| 4006 | 4006 | if ($virtualstock > 0) { |
| 4007 | 4007 | $optlabel .= '<span class="product_line_stock_ok">'; |
| 4008 | 4008 | } elseif ($virtualstock <= 0) { |
@@ -4016,7 +4016,7 @@ discard block |
||
| 4016 | 4016 | } |
| 4017 | 4017 | } |
| 4018 | 4018 | |
| 4019 | - $optstart = '<option value="' . $outkey . '"'; |
|
| 4019 | + $optstart = '<option value="'.$outkey.'"'; |
|
| 4020 | 4020 | if ($selected && $selected == $objp->idprodfournprice) { |
| 4021 | 4021 | $optstart .= ' selected'; |
| 4022 | 4022 | } |
@@ -4025,22 +4025,22 @@ discard block |
||
| 4025 | 4025 | } |
| 4026 | 4026 | |
| 4027 | 4027 | if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
| 4028 | - $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
|
| 4029 | - $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
|
| 4030 | - $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
|
| 4031 | - $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
|
| 4032 | - $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
|
| 4033 | - $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
|
| 4034 | - $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
|
| 4035 | - $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
|
| 4036 | - $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
|
| 4037 | - $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
| 4028 | + $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
| 4029 | + $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
| 4030 | + $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
| 4031 | + $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
| 4032 | + $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
| 4033 | + $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
| 4034 | + $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
| 4035 | + $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
| 4036 | + $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
| 4037 | + $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
|
| 4038 | 4038 | if (isModEnabled('multicurrency')) { |
| 4039 | - $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
|
| 4040 | - $optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
| 4039 | + $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
| 4040 | + $optstart .= ' data-multicurrency-unitprice="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
|
| 4041 | 4041 | } |
| 4042 | 4042 | } |
| 4043 | - $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
| 4043 | + $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
|
| 4044 | 4044 | |
| 4045 | 4045 | // set $parameters to call hook |
| 4046 | 4046 | $outarrayentry = array( |
@@ -4049,9 +4049,9 @@ discard block |
||
| 4049 | 4049 | 'label' => $outvallabel, |
| 4050 | 4050 | 'labelhtml' => $optlabel, |
| 4051 | 4051 | 'qty' => $outqty, |
| 4052 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
| 4053 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
| 4054 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
| 4052 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
| 4053 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
| 4054 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
| 4055 | 4055 | 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
| 4056 | 4056 | 'tva_tx' => price2num($objp->tva_tx), |
| 4057 | 4057 | 'default_vat_code' => $objp->default_vat_code, |
@@ -4081,18 +4081,18 @@ discard block |
||
| 4081 | 4081 | // Add new entry |
| 4082 | 4082 | // "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax |
| 4083 | 4083 | // "label" value of json key array is used by jQuery automatically as text for combo box |
| 4084 | - $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
| 4084 | + $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
|
| 4085 | 4085 | $outarraypush = array( |
| 4086 | 4086 | 'key' => $outkey, |
| 4087 | 4087 | 'value' => $outref, |
| 4088 | 4088 | 'label' => $outvallabel, |
| 4089 | 4089 | 'labelhtml' => $optlabel, |
| 4090 | 4090 | 'qty' => $outqty, |
| 4091 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
| 4091 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
| 4092 | 4092 | 'price_qty_ht_locale' => price($objp->fprice), |
| 4093 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
| 4093 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
| 4094 | 4094 | 'price_unit_ht_locale' => price($objp->unitprice), |
| 4095 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
| 4095 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
| 4096 | 4096 | 'tva_tx_formated' => price($objp->tva_tx), |
| 4097 | 4097 | 'tva_tx' => price2num($objp->tva_tx), |
| 4098 | 4098 | 'default_vat_code' => $objp->default_vat_code, |
@@ -4125,7 +4125,7 @@ discard block |
||
| 4125 | 4125 | |
| 4126 | 4126 | $this->db->free($result); |
| 4127 | 4127 | |
| 4128 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 4128 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 4129 | 4129 | $out .= ajax_combobox($htmlname); |
| 4130 | 4130 | } else { |
| 4131 | 4131 | dol_print_error($this->db); |
@@ -4157,43 +4157,43 @@ discard block |
||
| 4157 | 4157 | $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
| 4158 | 4158 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
| 4159 | 4159 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
| 4160 | - $sql .= " FROM " . $this->db->prefix() . "product as p"; |
|
| 4161 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
| 4162 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
| 4163 | - $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
| 4160 | + $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
| 4161 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
| 4162 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
| 4163 | + $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
|
| 4164 | 4164 | $sql .= " AND p.tobuy = 1"; |
| 4165 | 4165 | $sql .= " AND s.fournisseur = 1"; |
| 4166 | - $sql .= " AND p.rowid = " . ((int) $productid); |
|
| 4166 | + $sql .= " AND p.rowid = ".((int) $productid); |
|
| 4167 | 4167 | if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
| 4168 | 4168 | $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
| 4169 | 4169 | } else { |
| 4170 | 4170 | $sql .= " ORDER BY pfp.unitprice ASC"; |
| 4171 | 4171 | } |
| 4172 | 4172 | |
| 4173 | - dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
| 4173 | + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
|
| 4174 | 4174 | $result = $this->db->query($sql); |
| 4175 | 4175 | |
| 4176 | 4176 | if ($result) { |
| 4177 | 4177 | $num = $this->db->num_rows($result); |
| 4178 | 4178 | |
| 4179 | - $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 4179 | + $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 4180 | 4180 | |
| 4181 | 4181 | if (!$num) { |
| 4182 | - $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
| 4182 | + $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
|
| 4183 | 4183 | } else { |
| 4184 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
| 4184 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
| 4185 | 4185 | $form .= '<option value="0"> </option>'; |
| 4186 | 4186 | |
| 4187 | 4187 | $i = 0; |
| 4188 | 4188 | while ($i < $num) { |
| 4189 | 4189 | $objp = $this->db->fetch_object($result); |
| 4190 | 4190 | |
| 4191 | - $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
| 4191 | + $opt = '<option value="'.$objp->idprodfournprice.'"'; |
|
| 4192 | 4192 | //if there is only one supplier, preselect it |
| 4193 | 4193 | if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
| 4194 | 4194 | $opt .= ' selected'; |
| 4195 | 4195 | } |
| 4196 | - $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
| 4196 | + $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
|
| 4197 | 4197 | |
| 4198 | 4198 | if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
| 4199 | 4199 | $prod_supplier = new ProductFournisseur($this->db); |
@@ -4203,7 +4203,7 @@ discard block |
||
| 4203 | 4203 | $prod_supplier->fourn_tva_tx = $objp->tva_tx; |
| 4204 | 4204 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
| 4205 | 4205 | |
| 4206 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
| 4206 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
| 4207 | 4207 | $priceparser = new PriceParser($this->db); |
| 4208 | 4208 | $price_result = $priceparser->parseProductSupplier($prod_supplier); |
| 4209 | 4209 | if ($price_result >= 0) { |
@@ -4214,10 +4214,10 @@ discard block |
||
| 4214 | 4214 | } |
| 4215 | 4215 | } |
| 4216 | 4216 | if ($objp->quantity == 1) { |
| 4217 | - $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
| 4217 | + $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
| 4218 | 4218 | } |
| 4219 | 4219 | |
| 4220 | - $opt .= $objp->quantity . ' '; |
|
| 4220 | + $opt .= $objp->quantity.' '; |
|
| 4221 | 4221 | |
| 4222 | 4222 | if ($objp->quantity == 1) { |
| 4223 | 4223 | $opt .= $langs->trans("Unit"); |
@@ -4226,10 +4226,10 @@ discard block |
||
| 4226 | 4226 | } |
| 4227 | 4227 | if ($objp->quantity > 1) { |
| 4228 | 4228 | $opt .= " - "; |
| 4229 | - $opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit"); |
|
| 4229 | + $opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); |
|
| 4230 | 4230 | } |
| 4231 | 4231 | if ($objp->duration) { |
| 4232 | - $opt .= " - " . $objp->duration; |
|
| 4232 | + $opt .= " - ".$objp->duration; |
|
| 4233 | 4233 | } |
| 4234 | 4234 | $opt .= "</option>\n"; |
| 4235 | 4235 | |
@@ -4267,8 +4267,8 @@ discard block |
||
| 4267 | 4267 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 4268 | 4268 | |
| 4269 | 4269 | $sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
| 4270 | - $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
|
| 4271 | - $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
| 4270 | + $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
| 4271 | + $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
|
| 4272 | 4272 | $sql .= " AND active > 0"; |
| 4273 | 4273 | $sql .= " ORDER BY sortorder"; |
| 4274 | 4274 | |
@@ -4280,7 +4280,7 @@ discard block |
||
| 4280 | 4280 | $obj = $this->db->fetch_object($resql); |
| 4281 | 4281 | |
| 4282 | 4282 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default |
| 4283 | - $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4283 | + $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4284 | 4284 | $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
| 4285 | 4285 | $this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
| 4286 | 4286 | $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
@@ -4308,7 +4308,7 @@ discard block |
||
| 4308 | 4308 | // phpcs:enable |
| 4309 | 4309 | global $langs; |
| 4310 | 4310 | |
| 4311 | - $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
| 4311 | + $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
| 4312 | 4312 | if ($num > 0) { |
| 4313 | 4313 | return 0; // Cache already loaded |
| 4314 | 4314 | } |
@@ -4318,7 +4318,7 @@ discard block |
||
| 4318 | 4318 | $langs->load('propal'); |
| 4319 | 4319 | |
| 4320 | 4320 | $sql = "SELECT rowid, code, label, position"; |
| 4321 | - $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
| 4321 | + $sql .= " FROM ".$this->db->prefix().'c_availability'; |
|
| 4322 | 4322 | $sql .= " WHERE active > 0"; |
| 4323 | 4323 | |
| 4324 | 4324 | $resql = $this->db->query($sql); |
@@ -4329,7 +4329,7 @@ discard block |
||
| 4329 | 4329 | $obj = $this->db->fetch_object($resql); |
| 4330 | 4330 | |
| 4331 | 4331 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default |
| 4332 | - $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4332 | + $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4333 | 4333 | $this->cache_availability[$obj->rowid]['code'] = $obj->code; |
| 4334 | 4334 | $this->cache_availability[$obj->rowid]['label'] = $label; |
| 4335 | 4335 | $this->cache_availability[$obj->rowid]['position'] = $obj->position; |
@@ -4361,17 +4361,17 @@ discard block |
||
| 4361 | 4361 | |
| 4362 | 4362 | $this->load_cache_availability(); |
| 4363 | 4363 | |
| 4364 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
| 4364 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
| 4365 | 4365 | |
| 4366 | - print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
| 4366 | + print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
| 4367 | 4367 | if ($addempty) { |
| 4368 | 4368 | print '<option value="0"> </option>'; |
| 4369 | 4369 | } |
| 4370 | 4370 | foreach ($this->cache_availability as $id => $arrayavailability) { |
| 4371 | 4371 | if ($selected == $id) { |
| 4372 | - print '<option value="' . $id . '" selected>'; |
|
| 4372 | + print '<option value="'.$id.'" selected>'; |
|
| 4373 | 4373 | } else { |
| 4374 | - print '<option value="' . $id . '">'; |
|
| 4374 | + print '<option value="'.$id.'">'; |
|
| 4375 | 4375 | } |
| 4376 | 4376 | print dol_escape_htmltag($arrayavailability['label']); |
| 4377 | 4377 | print '</option>'; |
@@ -4392,13 +4392,13 @@ discard block |
||
| 4392 | 4392 | { |
| 4393 | 4393 | global $langs; |
| 4394 | 4394 | |
| 4395 | - $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
| 4395 | + $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
| 4396 | 4396 | if ($num > 0) { |
| 4397 | 4397 | return 0; // Cache already loaded |
| 4398 | 4398 | } |
| 4399 | 4399 | |
| 4400 | 4400 | $sql = "SELECT rowid, code, label"; |
| 4401 | - $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
| 4401 | + $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
|
| 4402 | 4402 | $sql .= " WHERE active > 0"; |
| 4403 | 4403 | |
| 4404 | 4404 | $resql = $this->db->query($sql); |
@@ -4411,8 +4411,8 @@ discard block |
||
| 4411 | 4411 | |
| 4412 | 4412 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default |
| 4413 | 4413 | $label = ($obj->label != '-' ? $obj->label : ''); |
| 4414 | - if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
|
| 4415 | - $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
| 4414 | + if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
| 4415 | + $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
| 4416 | 4416 | } |
| 4417 | 4417 | if ($langs->trans($obj->code) != $obj->code) { |
| 4418 | 4418 | $label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
@@ -4452,9 +4452,9 @@ discard block |
||
| 4452 | 4452 | |
| 4453 | 4453 | $this->loadCacheInputReason(); |
| 4454 | 4454 | |
| 4455 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 4455 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 4456 | 4456 | if ($addempty) { |
| 4457 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
| 4457 | + print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
|
| 4458 | 4458 | } |
| 4459 | 4459 | foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
| 4460 | 4460 | if ($arraydemandreason['code'] == $exclude) { |
@@ -4462,9 +4462,9 @@ discard block |
||
| 4462 | 4462 | } |
| 4463 | 4463 | |
| 4464 | 4464 | if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
| 4465 | - print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
| 4465 | + print '<option value="'.$arraydemandreason['id'].'" selected>'; |
|
| 4466 | 4466 | } else { |
| 4467 | - print '<option value="' . $arraydemandreason['id'] . '">'; |
|
| 4467 | + print '<option value="'.$arraydemandreason['id'].'">'; |
|
| 4468 | 4468 | } |
| 4469 | 4469 | $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
| 4470 | 4470 | print $langs->trans($label); |
@@ -4474,7 +4474,7 @@ discard block |
||
| 4474 | 4474 | if ($user->admin && empty($notooltip)) { |
| 4475 | 4475 | print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
| 4476 | 4476 | } |
| 4477 | - print ajax_combobox('select_' . $htmlname); |
|
| 4477 | + print ajax_combobox('select_'.$htmlname); |
|
| 4478 | 4478 | } |
| 4479 | 4479 | |
| 4480 | 4480 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
@@ -4489,7 +4489,7 @@ discard block |
||
| 4489 | 4489 | // phpcs:enable |
| 4490 | 4490 | global $langs; |
| 4491 | 4491 | |
| 4492 | - $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
| 4492 | + $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
| 4493 | 4493 | if ($num > 0) { |
| 4494 | 4494 | return $num; // Cache already loaded |
| 4495 | 4495 | } |
@@ -4499,8 +4499,8 @@ discard block |
||
| 4499 | 4499 | $this->cache_types_paiements = array(); |
| 4500 | 4500 | |
| 4501 | 4501 | $sql = "SELECT id, code, libelle as label, type, active"; |
| 4502 | - $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
|
| 4503 | - $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
| 4502 | + $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
| 4503 | + $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
|
| 4504 | 4504 | |
| 4505 | 4505 | $resql = $this->db->query($sql); |
| 4506 | 4506 | if ($resql) { |
@@ -4510,7 +4510,7 @@ discard block |
||
| 4510 | 4510 | $obj = $this->db->fetch_object($resql); |
| 4511 | 4511 | |
| 4512 | 4512 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default |
| 4513 | - $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4513 | + $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4514 | 4514 | $this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
| 4515 | 4515 | $this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
| 4516 | 4516 | $this->cache_types_paiements[$obj->id]['label'] = $label; |
@@ -4582,17 +4582,17 @@ discard block |
||
| 4582 | 4582 | global $langs, $user, $conf; |
| 4583 | 4583 | |
| 4584 | 4584 | $out = ''; |
| 4585 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
| 4585 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
| 4586 | 4586 | |
| 4587 | 4587 | $this->load_cache_conditions_paiements(); |
| 4588 | 4588 | |
| 4589 | 4589 | // Set default value if not already set by caller |
| 4590 | 4590 | if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
| 4591 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
| 4591 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
| 4592 | 4592 | $selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
| 4593 | 4593 | } |
| 4594 | 4594 | |
| 4595 | - $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
| 4595 | + $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
| 4596 | 4596 | if ($addempty) { |
| 4597 | 4597 | $out .= '<option value="0"> </option>'; |
| 4598 | 4598 | } |
@@ -4606,9 +4606,9 @@ discard block |
||
| 4606 | 4606 | |
| 4607 | 4607 | if ($selected == $id) { |
| 4608 | 4608 | $selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
| 4609 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
| 4609 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
|
| 4610 | 4610 | } else { |
| 4611 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
| 4611 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
|
| 4612 | 4612 | } |
| 4613 | 4613 | $label = $arrayconditions['label']; |
| 4614 | 4614 | |
@@ -4626,21 +4626,21 @@ discard block |
||
| 4626 | 4626 | $out .= ajax_combobox($htmlname); |
| 4627 | 4627 | |
| 4628 | 4628 | if ($deposit_percent >= 0) { |
| 4629 | - $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
|
| 4630 | - $out .= $langs->trans('DepositPercent') . ' : '; |
|
| 4631 | - $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
| 4629 | + $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
| 4630 | + $out .= $langs->trans('DepositPercent').' : '; |
|
| 4631 | + $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
|
| 4632 | 4632 | $out .= '</span>'; |
| 4633 | 4633 | $out .= ' |
| 4634 | - <script nonce="' . getNonce() . '"> |
|
| 4634 | + <script nonce="' . getNonce().'"> |
|
| 4635 | 4635 | $(document).ready(function () { |
| 4636 | - $("#' . $htmlname . '").change(function () { |
|
| 4636 | + $("#' . $htmlname.'").change(function () { |
|
| 4637 | 4637 | let $selected = $(this).find("option:selected"); |
| 4638 | 4638 | let depositPercent = $selected.attr("data-deposit_percent"); |
| 4639 | 4639 | |
| 4640 | 4640 | if (depositPercent.length > 0) { |
| 4641 | - $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
| 4641 | + $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
|
| 4642 | 4642 | } else { |
| 4643 | - $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
| 4643 | + $("#' . $htmlname.'_deposit_percent_container").hide(); |
|
| 4644 | 4644 | } |
| 4645 | 4645 | |
| 4646 | 4646 | return true; |
@@ -4678,7 +4678,7 @@ discard block |
||
| 4678 | 4678 | |
| 4679 | 4679 | $out = ''; |
| 4680 | 4680 | |
| 4681 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
| 4681 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
|
| 4682 | 4682 | |
| 4683 | 4683 | $filterarray = array(); |
| 4684 | 4684 | if ($filtertype == 'CRDT') { |
@@ -4693,11 +4693,11 @@ discard block |
||
| 4693 | 4693 | |
| 4694 | 4694 | // Set default value if not already set by caller |
| 4695 | 4695 | if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
| 4696 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
| 4696 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
| 4697 | 4697 | $selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
| 4698 | 4698 | } |
| 4699 | 4699 | |
| 4700 | - $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
| 4700 | + $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
| 4701 | 4701 | if ($empty) { |
| 4702 | 4702 | $out .= '<option value=""> </option>'; |
| 4703 | 4703 | } |
@@ -4718,13 +4718,13 @@ discard block |
||
| 4718 | 4718 | } |
| 4719 | 4719 | |
| 4720 | 4720 | if ($format == 0) { |
| 4721 | - $out .= '<option value="' . $id . '" data-code="'.$arraytypes['code'].'"'; |
|
| 4721 | + $out .= '<option value="'.$id.'" data-code="'.$arraytypes['code'].'"'; |
|
| 4722 | 4722 | } elseif ($format == 1) { |
| 4723 | - $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
| 4723 | + $out .= '<option value="'.$arraytypes['code'].'"'; |
|
| 4724 | 4724 | } elseif ($format == 2) { |
| 4725 | - $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
| 4725 | + $out .= '<option value="'.$arraytypes['code'].'"'; |
|
| 4726 | 4726 | } elseif ($format == 3) { |
| 4727 | - $out .= '<option value="' . $id . '"'; |
|
| 4727 | + $out .= '<option value="'.$id.'"'; |
|
| 4728 | 4728 | } |
| 4729 | 4729 | // Print attribute selected or not |
| 4730 | 4730 | if ($format == 1 || $format == 2) { |
@@ -4754,7 +4754,7 @@ discard block |
||
| 4754 | 4754 | if ($user->admin && !$noadmininfo) { |
| 4755 | 4755 | $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
| 4756 | 4756 | } |
| 4757 | - $out .= ajax_combobox('select' . $htmlname); |
|
| 4757 | + $out .= ajax_combobox('select'.$htmlname); |
|
| 4758 | 4758 | |
| 4759 | 4759 | if (empty($nooutput)) { |
| 4760 | 4760 | print $out; |
@@ -4776,22 +4776,22 @@ discard block |
||
| 4776 | 4776 | { |
| 4777 | 4777 | global $langs; |
| 4778 | 4778 | |
| 4779 | - $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 4779 | + $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 4780 | 4780 | $options = array( |
| 4781 | 4781 | 'HT' => $langs->trans("HT"), |
| 4782 | 4782 | 'TTC' => $langs->trans("TTC") |
| 4783 | 4783 | ); |
| 4784 | 4784 | foreach ($options as $id => $value) { |
| 4785 | 4785 | if ($selected == $id) { |
| 4786 | - $return .= '<option value="' . $id . '" selected>' . $value; |
|
| 4786 | + $return .= '<option value="'.$id.'" selected>'.$value; |
|
| 4787 | 4787 | } else { |
| 4788 | - $return .= '<option value="' . $id . '">' . $value; |
|
| 4788 | + $return .= '<option value="'.$id.'">'.$value; |
|
| 4789 | 4789 | } |
| 4790 | 4790 | $return .= '</option>'; |
| 4791 | 4791 | } |
| 4792 | 4792 | $return .= '</select>'; |
| 4793 | 4793 | if ($addjscombo) { |
| 4794 | - $return .= ajax_combobox('select_' . $htmlname); |
|
| 4794 | + $return .= ajax_combobox('select_'.$htmlname); |
|
| 4795 | 4795 | } |
| 4796 | 4796 | |
| 4797 | 4797 | return $return; |
@@ -4809,7 +4809,7 @@ discard block |
||
| 4809 | 4809 | // phpcs:enable |
| 4810 | 4810 | global $langs; |
| 4811 | 4811 | |
| 4812 | - $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
| 4812 | + $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
| 4813 | 4813 | if ($num > 0) { |
| 4814 | 4814 | return $num; // Cache already loaded |
| 4815 | 4815 | } |
@@ -4819,8 +4819,8 @@ discard block |
||
| 4819 | 4819 | $this->cache_transport_mode = array(); |
| 4820 | 4820 | |
| 4821 | 4821 | $sql = "SELECT rowid, code, label, active"; |
| 4822 | - $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
|
| 4823 | - $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
| 4822 | + $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
| 4823 | + $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
|
| 4824 | 4824 | |
| 4825 | 4825 | $resql = $this->db->query($sql); |
| 4826 | 4826 | if ($resql) { |
@@ -4830,7 +4830,7 @@ discard block |
||
| 4830 | 4830 | $obj = $this->db->fetch_object($resql); |
| 4831 | 4831 | |
| 4832 | 4832 | // If traduction exist, we use it else we take the default label |
| 4833 | - $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4833 | + $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 4834 | 4834 | $this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
| 4835 | 4835 | $this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
| 4836 | 4836 | $this->cache_transport_mode[$obj->rowid]['label'] = $label; |
@@ -4864,11 +4864,11 @@ discard block |
||
| 4864 | 4864 | { |
| 4865 | 4865 | global $langs, $user; |
| 4866 | 4866 | |
| 4867 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
| 4867 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
|
| 4868 | 4868 | |
| 4869 | 4869 | $this->load_cache_transport_mode(); |
| 4870 | 4870 | |
| 4871 | - print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
| 4871 | + print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
| 4872 | 4872 | if ($empty) { |
| 4873 | 4873 | print '<option value=""> </option>'; |
| 4874 | 4874 | } |
@@ -4884,13 +4884,13 @@ discard block |
||
| 4884 | 4884 | } |
| 4885 | 4885 | |
| 4886 | 4886 | if ($format == 0) { |
| 4887 | - print '<option value="' . $id . '"'; |
|
| 4887 | + print '<option value="'.$id.'"'; |
|
| 4888 | 4888 | } elseif ($format == 1) { |
| 4889 | - print '<option value="' . $arraytypes['code'] . '"'; |
|
| 4889 | + print '<option value="'.$arraytypes['code'].'"'; |
|
| 4890 | 4890 | } elseif ($format == 2) { |
| 4891 | - print '<option value="' . $arraytypes['code'] . '"'; |
|
| 4891 | + print '<option value="'.$arraytypes['code'].'"'; |
|
| 4892 | 4892 | } elseif ($format == 3) { |
| 4893 | - print '<option value="' . $id . '"'; |
|
| 4893 | + print '<option value="'.$id.'"'; |
|
| 4894 | 4894 | } |
| 4895 | 4895 | // If text is selected, we compare with code, else with id |
| 4896 | 4896 | if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
@@ -4941,31 +4941,31 @@ discard block |
||
| 4941 | 4941 | $langs->load("deliveries"); |
| 4942 | 4942 | |
| 4943 | 4943 | $sql = "SELECT rowid, code, libelle as label"; |
| 4944 | - $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
| 4944 | + $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
|
| 4945 | 4945 | $sql .= " WHERE active > 0"; |
| 4946 | 4946 | if ($filtre) { |
| 4947 | - $sql .= " AND " . $filtre; |
|
| 4947 | + $sql .= " AND ".$filtre; |
|
| 4948 | 4948 | } |
| 4949 | 4949 | $sql .= " ORDER BY libelle ASC"; |
| 4950 | 4950 | |
| 4951 | - dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
| 4951 | + dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
|
| 4952 | 4952 | $result = $this->db->query($sql); |
| 4953 | 4953 | if ($result) { |
| 4954 | 4954 | $num = $this->db->num_rows($result); |
| 4955 | 4955 | $i = 0; |
| 4956 | 4956 | if ($num) { |
| 4957 | - print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
| 4957 | + print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
| 4958 | 4958 | if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
| 4959 | 4959 | print '<option value="-1"> </option>'; |
| 4960 | 4960 | } |
| 4961 | 4961 | while ($i < $num) { |
| 4962 | 4962 | $obj = $this->db->fetch_object($result); |
| 4963 | 4963 | if ($selected == $obj->rowid) { |
| 4964 | - print '<option value="' . $obj->rowid . '" selected>'; |
|
| 4964 | + print '<option value="'.$obj->rowid.'" selected>'; |
|
| 4965 | 4965 | } else { |
| 4966 | - print '<option value="' . $obj->rowid . '">'; |
|
| 4966 | + print '<option value="'.$obj->rowid.'">'; |
|
| 4967 | 4967 | } |
| 4968 | - print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
| 4968 | + print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
|
| 4969 | 4969 | print '</option>'; |
| 4970 | 4970 | $i++; |
| 4971 | 4971 | } |
@@ -4974,7 +4974,7 @@ discard block |
||
| 4974 | 4974 | print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
| 4975 | 4975 | } |
| 4976 | 4976 | |
| 4977 | - print ajax_combobox('select' . $htmlname); |
|
| 4977 | + print ajax_combobox('select'.$htmlname); |
|
| 4978 | 4978 | } else { |
| 4979 | 4979 | print $langs->trans("NoShippingMethodDefined"); |
| 4980 | 4980 | } |
@@ -4999,16 +4999,16 @@ discard block |
||
| 4999 | 4999 | $langs->load("deliveries"); |
| 5000 | 5000 | |
| 5001 | 5001 | if ($htmlname != "none") { |
| 5002 | - print '<form method="POST" action="' . $page . '">'; |
|
| 5002 | + print '<form method="POST" action="'.$page.'">'; |
|
| 5003 | 5003 | print '<input type="hidden" name="action" value="setshippingmethod">'; |
| 5004 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 5004 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 5005 | 5005 | $this->selectShippingMethod($selected, $htmlname, '', $addempty); |
| 5006 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 5006 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 5007 | 5007 | print '</form>'; |
| 5008 | 5008 | } else { |
| 5009 | 5009 | if ($selected) { |
| 5010 | 5010 | $code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
| 5011 | - print $langs->trans("SendingMethod" . strtoupper($code)); |
|
| 5011 | + print $langs->trans("SendingMethod".strtoupper($code)); |
|
| 5012 | 5012 | } else { |
| 5013 | 5013 | print " "; |
| 5014 | 5014 | } |
@@ -5031,10 +5031,10 @@ discard block |
||
| 5031 | 5031 | |
| 5032 | 5032 | $opt = '<option value="" selected></option>'; |
| 5033 | 5033 | $sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
| 5034 | - $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
|
| 5035 | - $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
| 5034 | + $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
| 5035 | + $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
|
| 5036 | 5036 | $sql .= ' AND situation_counter >= 1'; |
| 5037 | - $sql .= ' AND fk_soc = ' . (int) $socid; |
|
| 5037 | + $sql .= ' AND fk_soc = '.(int) $socid; |
|
| 5038 | 5038 | $sql .= ' AND type <> 2'; |
| 5039 | 5039 | $sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
| 5040 | 5040 | $resql = $this->db->query($sql); |
@@ -5052,19 +5052,19 @@ discard block |
||
| 5052 | 5052 | //Not prov? |
| 5053 | 5053 | if (substr($obj->ref, 1, 4) != 'PROV') { |
| 5054 | 5054 | if ($selected == $obj->rowid) { |
| 5055 | - $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
| 5055 | + $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
|
| 5056 | 5056 | } else { |
| 5057 | - $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
| 5057 | + $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
|
| 5058 | 5058 | } |
| 5059 | 5059 | } |
| 5060 | 5060 | } |
| 5061 | 5061 | } |
| 5062 | 5062 | } |
| 5063 | 5063 | } else { |
| 5064 | - dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
| 5064 | + dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
|
| 5065 | 5065 | } |
| 5066 | 5066 | if ($opt == '<option value ="" selected></option>') { |
| 5067 | - $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
| 5067 | + $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
|
| 5068 | 5068 | } |
| 5069 | 5069 | return $opt; |
| 5070 | 5070 | } |
@@ -5084,12 +5084,12 @@ discard block |
||
| 5084 | 5084 | |
| 5085 | 5085 | $langs->load('products'); |
| 5086 | 5086 | |
| 5087 | - $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 5087 | + $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 5088 | 5088 | |
| 5089 | - $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
| 5089 | + $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
|
| 5090 | 5090 | $sql .= ' WHERE active > 0'; |
| 5091 | 5091 | if (!empty($unit_type)) { |
| 5092 | - $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
| 5092 | + $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
|
| 5093 | 5093 | } |
| 5094 | 5094 | $sql .= " ORDER BY sortorder"; |
| 5095 | 5095 | |
@@ -5101,14 +5101,14 @@ discard block |
||
| 5101 | 5101 | |
| 5102 | 5102 | while ($res = $this->db->fetch_object($resql)) { |
| 5103 | 5103 | $unitLabel = $res->label; |
| 5104 | - if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
|
| 5105 | - $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
| 5104 | + if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
| 5105 | + $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
|
| 5106 | 5106 | } |
| 5107 | 5107 | |
| 5108 | 5108 | if ($selected == $res->rowid) { |
| 5109 | - $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
| 5109 | + $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
|
| 5110 | 5110 | } else { |
| 5111 | - $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
| 5111 | + $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
|
| 5112 | 5112 | } |
| 5113 | 5113 | } |
| 5114 | 5114 | $return .= '</select>'; |
@@ -5143,29 +5143,29 @@ discard block |
||
| 5143 | 5143 | $num = 0; |
| 5144 | 5144 | |
| 5145 | 5145 | $sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
| 5146 | - $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
|
| 5147 | - $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
| 5146 | + $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
| 5147 | + $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
|
| 5148 | 5148 | if ($status != 2) { |
| 5149 | - $sql .= " AND clos = " . (int) $status; |
|
| 5149 | + $sql .= " AND clos = ".(int) $status; |
|
| 5150 | 5150 | } |
| 5151 | 5151 | if ($filtre) { // TODO Support USF |
| 5152 | - $sql .= " AND " . $filtre; |
|
| 5152 | + $sql .= " AND ".$filtre; |
|
| 5153 | 5153 | } |
| 5154 | 5154 | $sql .= " ORDER BY label"; |
| 5155 | 5155 | |
| 5156 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
| 5156 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
|
| 5157 | 5157 | $result = $this->db->query($sql); |
| 5158 | 5158 | if ($result) { |
| 5159 | 5159 | $num = $this->db->num_rows($result); |
| 5160 | 5160 | $i = 0; |
| 5161 | 5161 | |
| 5162 | - $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
| 5162 | + $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
| 5163 | 5163 | |
| 5164 | 5164 | if ($num == 0) { |
| 5165 | 5165 | if ($status == 0) { |
| 5166 | - $out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
| 5166 | + $out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
|
| 5167 | 5167 | } else { |
| 5168 | - $out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>'; |
|
| 5168 | + $out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>'; |
|
| 5169 | 5169 | } |
| 5170 | 5170 | } else { |
| 5171 | 5171 | if (!empty($useempty) && !is_numeric($useempty)) { |
@@ -5181,25 +5181,25 @@ discard block |
||
| 5181 | 5181 | $labeltoshow = trim($obj->label); |
| 5182 | 5182 | $labeltoshowhtml = trim($obj->label); |
| 5183 | 5183 | if ($showcurrency) { |
| 5184 | - $labeltoshow .= ' (' . $obj->currency_code . ')'; |
|
| 5185 | - $labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->currency_code . ')</span>'; |
|
| 5184 | + $labeltoshow .= ' ('.$obj->currency_code.')'; |
|
| 5185 | + $labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->currency_code.')</span>'; |
|
| 5186 | 5186 | } |
| 5187 | 5187 | if ($status == 2 && $obj->status == 1) { |
| 5188 | - $labeltoshow .= ' (' . $langs->trans("Closed") . ')'; |
|
| 5189 | - $labeltoshowhtml .= ' <span class="opacitymedium">(' . $langs->trans("Closed") . ')</span>'; |
|
| 5188 | + $labeltoshow .= ' ('.$langs->trans("Closed").')'; |
|
| 5189 | + $labeltoshowhtml .= ' <span class="opacitymedium">('.$langs->trans("Closed").')</span>'; |
|
| 5190 | 5190 | } |
| 5191 | 5191 | |
| 5192 | 5192 | if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
| 5193 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>'; |
|
| 5193 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>'; |
|
| 5194 | 5194 | } else { |
| 5195 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">'; |
|
| 5195 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">'; |
|
| 5196 | 5196 | } |
| 5197 | 5197 | $out .= $labeltoshow; |
| 5198 | 5198 | $out .= '</option>'; |
| 5199 | 5199 | $i++; |
| 5200 | 5200 | } |
| 5201 | 5201 | $out .= "</select>"; |
| 5202 | - $out .= ajax_combobox('select' . $htmlname); |
|
| 5202 | + $out .= ajax_combobox('select'.$htmlname); |
|
| 5203 | 5203 | } else { |
| 5204 | 5204 | dol_print_error($this->db); |
| 5205 | 5205 | } |
@@ -5238,22 +5238,22 @@ discard block |
||
| 5238 | 5238 | $num = 0; |
| 5239 | 5239 | |
| 5240 | 5240 | $sql = "SELECT rowid, label, bank, status, iban_prefix, bic"; |
| 5241 | - $sql .= " FROM " . $this->db->prefix() . "societe_rib"; |
|
| 5242 | - $sql.= " WHERE type = 'ban'"; |
|
| 5241 | + $sql .= " FROM ".$this->db->prefix()."societe_rib"; |
|
| 5242 | + $sql .= " WHERE type = 'ban'"; |
|
| 5243 | 5243 | if ($filtre) { // TODO Support USF |
| 5244 | - $sql .= " AND " . $filtre; |
|
| 5244 | + $sql .= " AND ".$filtre; |
|
| 5245 | 5245 | } |
| 5246 | 5246 | $sql .= " ORDER BY label"; |
| 5247 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
| 5247 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
|
| 5248 | 5248 | $result = $this->db->query($sql); |
| 5249 | 5249 | if ($result) { |
| 5250 | 5250 | $num = $this->db->num_rows($result); |
| 5251 | 5251 | $i = 0; |
| 5252 | 5252 | |
| 5253 | - $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
| 5253 | + $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
| 5254 | 5254 | |
| 5255 | 5255 | if ($num == 0) { |
| 5256 | - $out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>'; |
|
| 5256 | + $out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>'; |
|
| 5257 | 5257 | } else { |
| 5258 | 5258 | if (!empty($useempty) && !is_numeric($useempty)) { |
| 5259 | 5259 | $out .= '<option value="-1">'.$langs->trans($useempty).'</option>'; |
@@ -5266,19 +5266,19 @@ discard block |
||
| 5266 | 5266 | $obj = $this->db->fetch_object($result); |
| 5267 | 5267 | $iban = dolDecrypt($obj->iban_prefix); |
| 5268 | 5268 | if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
| 5269 | - $out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '" selected>'; |
|
| 5269 | + $out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'" selected>'; |
|
| 5270 | 5270 | } else { |
| 5271 | - $out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '">'; |
|
| 5271 | + $out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'">'; |
|
| 5272 | 5272 | } |
| 5273 | 5273 | $out .= trim($obj->label); |
| 5274 | 5274 | if ($showibanbic) { |
| 5275 | - $out .= ' (' . $iban . '/' .$obj->bic. ')'; |
|
| 5275 | + $out .= ' ('.$iban.'/'.$obj->bic.')'; |
|
| 5276 | 5276 | } |
| 5277 | 5277 | $out .= '</option>'; |
| 5278 | 5278 | $i++; |
| 5279 | 5279 | } |
| 5280 | 5280 | $out .= "</select>"; |
| 5281 | - $out .= ajax_combobox('select' . $htmlname); |
|
| 5281 | + $out .= ajax_combobox('select'.$htmlname); |
|
| 5282 | 5282 | } else { |
| 5283 | 5283 | dol_print_error($this->db); |
| 5284 | 5284 | } |
@@ -5312,23 +5312,23 @@ discard block |
||
| 5312 | 5312 | $num = 0; |
| 5313 | 5313 | |
| 5314 | 5314 | $sql = "SELECT rowid, name, fk_country, status, entity"; |
| 5315 | - $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
| 5315 | + $sql .= " FROM ".$this->db->prefix()."establishment"; |
|
| 5316 | 5316 | $sql .= " WHERE 1=1"; |
| 5317 | 5317 | if ($status != 2) { |
| 5318 | - $sql .= " AND status = " . (int) $status; |
|
| 5318 | + $sql .= " AND status = ".(int) $status; |
|
| 5319 | 5319 | } |
| 5320 | 5320 | if ($filtre) { // TODO Support USF |
| 5321 | - $sql .= " AND " . $filtre; |
|
| 5321 | + $sql .= " AND ".$filtre; |
|
| 5322 | 5322 | } |
| 5323 | 5323 | $sql .= " ORDER BY name"; |
| 5324 | 5324 | |
| 5325 | - dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
| 5325 | + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
|
| 5326 | 5326 | $result = $this->db->query($sql); |
| 5327 | 5327 | if ($result) { |
| 5328 | 5328 | $num = $this->db->num_rows($result); |
| 5329 | 5329 | $i = 0; |
| 5330 | 5330 | if ($num) { |
| 5331 | - print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
| 5331 | + print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
| 5332 | 5332 | if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
| 5333 | 5333 | print '<option value="-1"> </option>'; |
| 5334 | 5334 | } |
@@ -5336,13 +5336,13 @@ discard block |
||
| 5336 | 5336 | while ($i < $num) { |
| 5337 | 5337 | $obj = $this->db->fetch_object($result); |
| 5338 | 5338 | if ($selected == $obj->rowid) { |
| 5339 | - print '<option value="' . $obj->rowid . '" selected>'; |
|
| 5339 | + print '<option value="'.$obj->rowid.'" selected>'; |
|
| 5340 | 5340 | } else { |
| 5341 | - print '<option value="' . $obj->rowid . '">'; |
|
| 5341 | + print '<option value="'.$obj->rowid.'">'; |
|
| 5342 | 5342 | } |
| 5343 | 5343 | print trim($obj->name); |
| 5344 | 5344 | if ($status == 2 && $obj->status == 1) { |
| 5345 | - print ' (' . $langs->trans("Closed") . ')'; |
|
| 5345 | + print ' ('.$langs->trans("Closed").')'; |
|
| 5346 | 5346 | } |
| 5347 | 5347 | print '</option>'; |
| 5348 | 5348 | $i++; |
@@ -5350,9 +5350,9 @@ discard block |
||
| 5350 | 5350 | print "</select>"; |
| 5351 | 5351 | } else { |
| 5352 | 5352 | if ($status == 0) { |
| 5353 | - print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
| 5353 | + print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
|
| 5354 | 5354 | } else { |
| 5355 | - print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
| 5355 | + print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
|
| 5356 | 5356 | } |
| 5357 | 5357 | } |
| 5358 | 5358 | |
@@ -5376,20 +5376,20 @@ discard block |
||
| 5376 | 5376 | { |
| 5377 | 5377 | global $langs; |
| 5378 | 5378 | if ($htmlname != "none") { |
| 5379 | - print '<form method="POST" action="' . $page . '">'; |
|
| 5379 | + print '<form method="POST" action="'.$page.'">'; |
|
| 5380 | 5380 | print '<input type="hidden" name="action" value="setbankaccount">'; |
| 5381 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 5381 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 5382 | 5382 | print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
| 5383 | 5383 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
| 5384 | 5384 | if ($nbaccountfound > 0) { |
| 5385 | - print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 5385 | + print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 5386 | 5386 | } |
| 5387 | 5387 | print '</form>'; |
| 5388 | 5388 | } else { |
| 5389 | 5389 | $langs->load('banks'); |
| 5390 | 5390 | |
| 5391 | 5391 | if ($selected) { |
| 5392 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
| 5392 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
| 5393 | 5393 | $bankstatic = new Account($this->db); |
| 5394 | 5394 | $result = $bankstatic->fetch($selected); |
| 5395 | 5395 | if ($result) { |
@@ -5416,24 +5416,24 @@ discard block |
||
| 5416 | 5416 | { |
| 5417 | 5417 | global $langs; |
| 5418 | 5418 | if ($htmlname != "none") { |
| 5419 | - print '<form method="POST" action="' . $page . '">'; |
|
| 5419 | + print '<form method="POST" action="'.$page.'">'; |
|
| 5420 | 5420 | print '<input type="hidden" name="action" value="setbankaccountcustomer">'; |
| 5421 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 5421 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 5422 | 5422 | $nbaccountfound = $this->selectRib($selected, $htmlname, $filtre, $addempty, '', $showibanbic); |
| 5423 | 5423 | if ($nbaccountfound > 0) { |
| 5424 | - print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 5424 | + print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 5425 | 5425 | } |
| 5426 | 5426 | print '</form>'; |
| 5427 | 5427 | } else { |
| 5428 | 5428 | $langs->load('banks'); |
| 5429 | 5429 | |
| 5430 | 5430 | if ($selected) { |
| 5431 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 5431 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 5432 | 5432 | $bankstatic = new CompanyBankAccount($this->db); |
| 5433 | 5433 | $result = $bankstatic->fetch($selected); |
| 5434 | 5434 | if ($result) { |
| 5435 | 5435 | print $bankstatic->label; |
| 5436 | - if ($showibanbic) print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')'; |
|
| 5436 | + if ($showibanbic) print ' ('.$bankstatic->iban.'/'.$bankstatic->bic.')'; |
|
| 5437 | 5437 | } |
| 5438 | 5438 | } else { |
| 5439 | 5439 | print " "; |
@@ -5468,11 +5468,11 @@ discard block |
||
| 5468 | 5468 | global $conf, $langs; |
| 5469 | 5469 | $langs->load("categories"); |
| 5470 | 5470 | |
| 5471 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 5471 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 5472 | 5472 | |
| 5473 | 5473 | // For backward compatibility |
| 5474 | 5474 | if (is_numeric($type)) { |
| 5475 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
| 5475 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
| 5476 | 5476 | } |
| 5477 | 5477 | |
| 5478 | 5478 | if ($type === Categorie::TYPE_BANK_LINE) { |
@@ -5480,8 +5480,8 @@ discard block |
||
| 5480 | 5480 | $cat = new Categorie($this->db); |
| 5481 | 5481 | $cate_arbo = array(); |
| 5482 | 5482 | $sql = "SELECT c.label, c.rowid"; |
| 5483 | - $sql .= " FROM " . $this->db->prefix() . "categorie as c"; |
|
| 5484 | - $sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]); |
|
| 5483 | + $sql .= " FROM ".$this->db->prefix()."categorie as c"; |
|
| 5484 | + $sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]); |
|
| 5485 | 5485 | $sql .= " ORDER BY c.label"; |
| 5486 | 5486 | $result = $this->db->query($sql); |
| 5487 | 5487 | if ($result) { |
@@ -5507,12 +5507,12 @@ discard block |
||
| 5507 | 5507 | $outarrayrichhtml = array(); |
| 5508 | 5508 | |
| 5509 | 5509 | |
| 5510 | - $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 5510 | + $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 5511 | 5511 | if (is_array($cate_arbo)) { |
| 5512 | 5512 | $num = count($cate_arbo); |
| 5513 | 5513 | |
| 5514 | 5514 | if (!$num) { |
| 5515 | - $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
| 5515 | + $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
|
| 5516 | 5516 | } else { |
| 5517 | 5517 | if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
| 5518 | 5518 | $output .= '<option value="-1"> </option>'; |
@@ -5524,15 +5524,15 @@ discard block |
||
| 5524 | 5524 | $add = ''; |
| 5525 | 5525 | } |
| 5526 | 5526 | |
| 5527 | - $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
| 5527 | + $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
|
| 5528 | 5528 | $labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
| 5529 | 5529 | |
| 5530 | 5530 | $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
| 5531 | 5531 | |
| 5532 | 5532 | $outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
| 5533 | 5533 | |
| 5534 | - $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
|
| 5535 | - $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
| 5534 | + $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
| 5535 | + $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
|
| 5536 | 5536 | $output .= '>'; |
| 5537 | 5537 | $output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
| 5538 | 5538 | $output .= '</option>'; |
@@ -5578,7 +5578,7 @@ discard block |
||
| 5578 | 5578 | public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
| 5579 | 5579 | { |
| 5580 | 5580 | // phpcs:enable |
| 5581 | - dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
| 5581 | + dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
| 5582 | 5582 | print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
| 5583 | 5583 | } |
| 5584 | 5584 | |
@@ -5613,7 +5613,7 @@ discard block |
||
| 5613 | 5613 | { |
| 5614 | 5614 | global $langs, $conf; |
| 5615 | 5615 | |
| 5616 | - $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
| 5616 | + $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
|
| 5617 | 5617 | $formconfirm = ''; |
| 5618 | 5618 | $inputok = array(); |
| 5619 | 5619 | $inputko = array(); |
@@ -5637,27 +5637,27 @@ discard block |
||
| 5637 | 5637 | foreach ($formquestion as $key => $input) { |
| 5638 | 5638 | if (is_array($input) && !empty($input)) { |
| 5639 | 5639 | if ($input['type'] == 'hidden') { |
| 5640 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
|
| 5641 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
| 5640 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
| 5641 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
|
| 5642 | 5642 | |
| 5643 | - $more .= '<input type="hidden" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . dol_escape_htmltag($input['value']) . '" class="' . $morecss . '"' . $moreattr . '>' . "\n"; |
|
| 5643 | + $more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'" class="'.$morecss.'"'.$moreattr.'>'."\n"; |
|
| 5644 | 5644 | } |
| 5645 | 5645 | } |
| 5646 | 5646 | } |
| 5647 | 5647 | |
| 5648 | 5648 | // Now add questions |
| 5649 | 5649 | $moreonecolumn = ''; |
| 5650 | - $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
| 5650 | + $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
|
| 5651 | 5651 | foreach ($formquestion as $key => $input) { |
| 5652 | 5652 | if (is_array($input) && !empty($input)) { |
| 5653 | - $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
|
| 5654 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
|
| 5655 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
| 5653 | + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
| 5654 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
| 5655 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
|
| 5656 | 5656 | |
| 5657 | 5657 | if ($input['type'] == 'text') { |
| 5658 | - $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="text" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n"; |
|
| 5658 | + $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n"; |
|
| 5659 | 5659 | } elseif ($input['type'] == 'password') { |
| 5660 | - $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="password" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n"; |
|
| 5660 | + $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n"; |
|
| 5661 | 5661 | } elseif ($input['type'] == 'textarea') { |
| 5662 | 5662 | /*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
| 5663 | 5663 | $more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
@@ -5665,8 +5665,8 @@ discard block |
||
| 5665 | 5665 | $more .= '</textarea>'; |
| 5666 | 5666 | $more .= '</div></div>'."\n";*/ |
| 5667 | 5667 | $moreonecolumn .= '<div class="margintoponly">'; |
| 5668 | - $moreonecolumn .= $input['label'] . '<br>'; |
|
| 5669 | - $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
| 5668 | + $moreonecolumn .= $input['label'].'<br>'; |
|
| 5669 | + $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
|
| 5670 | 5670 | $moreonecolumn .= $input['value']; |
| 5671 | 5671 | $moreonecolumn .= '</textarea>'; |
| 5672 | 5672 | $moreonecolumn .= '</div>'; |
@@ -5683,20 +5683,20 @@ discard block |
||
| 5683 | 5683 | $disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
| 5684 | 5684 | $sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
| 5685 | 5685 | |
| 5686 | - $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
| 5686 | + $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
|
| 5687 | 5687 | if (!empty($input['label'])) { |
| 5688 | - $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
| 5688 | + $more .= $input['label'].'</div><div class="tagtd left">'; |
|
| 5689 | 5689 | } |
| 5690 | 5690 | if ($input['type'] == 'select') { |
| 5691 | 5691 | $more .= $this->selectarray($input['name'], $input['values'], isset($input['default']) ? $input['default'] : '-1', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); |
| 5692 | 5692 | } else { |
| 5693 | 5693 | $more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr); |
| 5694 | 5694 | } |
| 5695 | - $more .= '</div></div>' . "\n"; |
|
| 5695 | + $more .= '</div></div>'."\n"; |
|
| 5696 | 5696 | } elseif ($input['type'] == 'checkbox') { |
| 5697 | 5697 | $more .= '<div class="tagtr">'; |
| 5698 | - $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
|
| 5699 | - $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
| 5698 | + $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
| 5699 | + $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
|
| 5700 | 5700 | if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
| 5701 | 5701 | $more .= ' checked'; |
| 5702 | 5702 | } |
@@ -5707,19 +5707,19 @@ discard block |
||
| 5707 | 5707 | $more .= ' disabled'; |
| 5708 | 5708 | } |
| 5709 | 5709 | $more .= ' /></div>'; |
| 5710 | - $more .= '</div>' . "\n"; |
|
| 5710 | + $more .= '</div>'."\n"; |
|
| 5711 | 5711 | } elseif ($input['type'] == 'radio') { |
| 5712 | 5712 | $i = 0; |
| 5713 | 5713 | foreach ($input['values'] as $selkey => $selval) { |
| 5714 | 5714 | $more .= '<div class="tagtr">'; |
| 5715 | 5715 | if (isset($input['label'])) { |
| 5716 | 5716 | if ($i == 0) { |
| 5717 | - $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
| 5717 | + $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
|
| 5718 | 5718 | } else { |
| 5719 | - $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
| 5719 | + $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
|
| 5720 | 5720 | } |
| 5721 | 5721 | } |
| 5722 | - $more .= '<div class="tagtd' . ($i == 0 ? ' tdtop' : '') . '"><input type="radio" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name'] . $selkey) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . $selkey . '"' . $moreattr; |
|
| 5722 | + $more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name'].$selkey).'" name="'.dol_escape_htmltag($input['name']).'" value="'.$selkey.'"'.$moreattr; |
|
| 5723 | 5723 | if (!empty($input['disabled'])) { |
| 5724 | 5724 | $more .= ' disabled'; |
| 5725 | 5725 | } |
@@ -5727,12 +5727,12 @@ discard block |
||
| 5727 | 5727 | $more .= ' checked="checked"'; |
| 5728 | 5728 | } |
| 5729 | 5729 | $more .= ' /> '; |
| 5730 | - $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
|
| 5731 | - $more .= '</div></div>' . "\n"; |
|
| 5730 | + $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
| 5731 | + $more .= '</div></div>'."\n"; |
|
| 5732 | 5732 | $i++; |
| 5733 | 5733 | } |
| 5734 | 5734 | } elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
| 5735 | - $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
| 5735 | + $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
|
| 5736 | 5736 | $more .= '<div class="tagtd">'; |
| 5737 | 5737 | $addnowlink = (empty($input['datenow']) ? 0 : 1); |
| 5738 | 5738 | $h = $m = 0; |
@@ -5750,24 +5750,24 @@ discard block |
||
| 5750 | 5750 | } elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
| 5751 | 5751 | $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
| 5752 | 5752 | if (!empty($input['label'])) { |
| 5753 | - $more .= $input['label'] . '</div><div class="tagtd">'; |
|
| 5753 | + $more .= $input['label'].'</div><div class="tagtd">'; |
|
| 5754 | 5754 | } |
| 5755 | 5755 | $more .= $input['value']; |
| 5756 | - $more .= '</div></div>' . "\n"; |
|
| 5756 | + $more .= '</div></div>'."\n"; |
|
| 5757 | 5757 | } elseif ($input['type'] == 'onecolumn') { |
| 5758 | 5758 | $moreonecolumn .= '<div class="margintoponly">'; |
| 5759 | 5759 | $moreonecolumn .= $input['value']; |
| 5760 | - $moreonecolumn .= '</div>' . "\n"; |
|
| 5760 | + $moreonecolumn .= '</div>'."\n"; |
|
| 5761 | 5761 | } elseif ($input['type'] == 'hidden') { |
| 5762 | 5762 | // Do nothing more, already added by a previous loop |
| 5763 | 5763 | } elseif ($input['type'] == 'separator') { |
| 5764 | 5764 | $more .= '<br>'; |
| 5765 | 5765 | } else { |
| 5766 | - $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
| 5766 | + $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
|
| 5767 | 5767 | } |
| 5768 | 5768 | } |
| 5769 | 5769 | } |
| 5770 | - $more .= '</div>' . "\n"; |
|
| 5770 | + $more .= '</div>'."\n"; |
|
| 5771 | 5771 | $more .= $moreonecolumn; |
| 5772 | 5772 | } |
| 5773 | 5773 | |
@@ -5789,10 +5789,10 @@ discard block |
||
| 5789 | 5789 | $button = $useajax; |
| 5790 | 5790 | $useajax = 1; |
| 5791 | 5791 | $autoOpen = false; |
| 5792 | - $dialogconfirm .= '-' . $button; |
|
| 5792 | + $dialogconfirm .= '-'.$button; |
|
| 5793 | 5793 | } |
| 5794 | - $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
|
| 5795 | - $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
| 5794 | + $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
| 5795 | + $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
|
| 5796 | 5796 | |
| 5797 | 5797 | // Add input fields into list of fields to read during submit (inputok and inputko) |
| 5798 | 5798 | if (is_array($formquestion)) { |
@@ -5815,24 +5815,24 @@ discard block |
||
| 5815 | 5815 | } |
| 5816 | 5816 | |
| 5817 | 5817 | // Show JQuery confirm box. |
| 5818 | - $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
| 5818 | + $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
|
| 5819 | 5819 | if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
| 5820 | - $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
| 5820 | + $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
|
| 5821 | 5821 | } |
| 5822 | 5822 | if (!empty($more)) { |
| 5823 | - $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
| 5823 | + $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
|
| 5824 | 5824 | } |
| 5825 | - $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
|
| 5826 | - $formconfirm .= '</div>' . "\n"; |
|
| 5825 | + $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
| 5826 | + $formconfirm .= '</div>'."\n"; |
|
| 5827 | 5827 | |
| 5828 | - $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
|
| 5829 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
| 5828 | + $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
| 5829 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
|
| 5830 | 5830 | $formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
| 5831 | 5831 | $formconfirm .= 'jQuery(document).ready(function() { |
| 5832 | 5832 | $(function() { |
| 5833 | - $( "#' . $dialogconfirm . '" ).dialog( |
|
| 5833 | + $( "#' . $dialogconfirm.'" ).dialog( |
|
| 5834 | 5834 | { |
| 5835 | - autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
| 5835 | + autoOpen: ' . ($autoOpen ? "true" : "false").','; |
|
| 5836 | 5836 | if ($newselectedchoice == 'no') { |
| 5837 | 5837 | $formconfirm .= ' |
| 5838 | 5838 | open: function() { |
@@ -5842,24 +5842,24 @@ discard block |
||
| 5842 | 5842 | |
| 5843 | 5843 | $jsforcursor = ''; |
| 5844 | 5844 | if ($useajax == 1) { |
| 5845 | - $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
|
| 5846 | - $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
| 5845 | + $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
| 5846 | + $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
|
| 5847 | 5847 | } |
| 5848 | 5848 | |
| 5849 | 5849 | $postconfirmas = 'GET'; |
| 5850 | 5850 | |
| 5851 | 5851 | $formconfirm .= ' |
| 5852 | 5852 | resizable: false, |
| 5853 | - height: "' . $height . '", |
|
| 5854 | - width: "' . $width . '", |
|
| 5853 | + height: "' . $height.'", |
|
| 5854 | + width: "' . $width.'", |
|
| 5855 | 5855 | modal: true, |
| 5856 | 5856 | closeOnEscape: false, |
| 5857 | 5857 | buttons: { |
| 5858 | - "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
|
| 5859 | - var options = "token=' . urlencode(newToken()) . '"; |
|
| 5860 | - var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
|
| 5861 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
|
| 5862 | - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
| 5858 | + "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
| 5859 | + var options = "token=' . urlencode(newToken()).'"; |
|
| 5860 | + var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
| 5861 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
| 5862 | + var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
|
| 5863 | 5863 | |
| 5864 | 5864 | if (inputok.length > 0) { |
| 5865 | 5865 | $.each(inputok, function(i, inputname) { |
@@ -5893,11 +5893,11 @@ discard block |
||
| 5893 | 5893 | } |
| 5894 | 5894 | $(this).dialog("close"); |
| 5895 | 5895 | }, |
| 5896 | - "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
|
| 5897 | - var options = "token=' . urlencode(newToken()) . '"; |
|
| 5898 | - var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
|
| 5899 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
|
| 5900 | - var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
| 5896 | + "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
| 5897 | + var options = "token=' . urlencode(newToken()).'"; |
|
| 5898 | + var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
| 5899 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
| 5900 | + var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
|
| 5901 | 5901 | if (inputko.length > 0) { |
| 5902 | 5902 | $.each(inputko, function(i, inputname) { |
| 5903 | 5903 | var more = ""; |
@@ -5929,10 +5929,10 @@ discard block |
||
| 5929 | 5929 | } |
| 5930 | 5930 | ); |
| 5931 | 5931 | |
| 5932 | - var button = "' . $button . '"; |
|
| 5932 | + var button = "' . $button.'"; |
|
| 5933 | 5933 | if (button.length > 0) { |
| 5934 | 5934 | $( "#" + button ).click(function() { |
| 5935 | - $("#' . $dialogconfirm . '").dialog("open"); |
|
| 5935 | + $("#' . $dialogconfirm.'").dialog("open"); |
|
| 5936 | 5936 | }); |
| 5937 | 5937 | } |
| 5938 | 5938 | }); |
@@ -5940,44 +5940,44 @@ discard block |
||
| 5940 | 5940 | </script>'; |
| 5941 | 5941 | $formconfirm .= "<!-- end ajax formconfirm -->\n"; |
| 5942 | 5942 | } else { |
| 5943 | - $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
| 5943 | + $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
|
| 5944 | 5944 | |
| 5945 | 5945 | if (empty($disableformtag)) { |
| 5946 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n"; |
|
| 5946 | + $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n"; |
|
| 5947 | 5947 | } |
| 5948 | 5948 | |
| 5949 | - $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
|
| 5950 | - $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
| 5949 | + $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
| 5950 | + $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
|
| 5951 | 5951 | |
| 5952 | - $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
| 5952 | + $formconfirm .= '<table class="valid centpercent">'."\n"; |
|
| 5953 | 5953 | |
| 5954 | 5954 | // Line title |
| 5955 | 5955 | $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
| 5956 | - $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
|
| 5957 | - $formconfirm .= '</td></tr>' . "\n"; |
|
| 5956 | + $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
| 5957 | + $formconfirm .= '</td></tr>'."\n"; |
|
| 5958 | 5958 | |
| 5959 | 5959 | // Line text |
| 5960 | 5960 | if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
| 5961 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
| 5961 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
|
| 5962 | 5962 | } |
| 5963 | 5963 | |
| 5964 | 5964 | // Line form fields |
| 5965 | 5965 | if ($more) { |
| 5966 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
| 5966 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
|
| 5967 | 5967 | $formconfirm .= $more; |
| 5968 | - $formconfirm .= '</td></tr>' . "\n"; |
|
| 5968 | + $formconfirm .= '</td></tr>'."\n"; |
|
| 5969 | 5969 | } |
| 5970 | 5970 | |
| 5971 | 5971 | // Line with question |
| 5972 | 5972 | $formconfirm .= '<tr class="valid">'; |
| 5973 | - $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
| 5973 | + $formconfirm .= '<td class="valid">'.$question.'</td>'; |
|
| 5974 | 5974 | $formconfirm .= '<td class="valid center">'; |
| 5975 | 5975 | $formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
| 5976 | - $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
| 5976 | + $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
|
| 5977 | 5977 | $formconfirm .= '</td>'; |
| 5978 | - $formconfirm .= '</tr>' . "\n"; |
|
| 5978 | + $formconfirm .= '</tr>'."\n"; |
|
| 5979 | 5979 | |
| 5980 | - $formconfirm .= '</table>' . "\n"; |
|
| 5980 | + $formconfirm .= '</table>'."\n"; |
|
| 5981 | 5981 | |
| 5982 | 5982 | if (empty($disableformtag)) { |
| 5983 | 5983 | $formconfirm .= "</form>\n"; |
@@ -5986,7 +5986,7 @@ discard block |
||
| 5986 | 5986 | |
| 5987 | 5987 | if (!empty($conf->use_javascript_ajax)) { |
| 5988 | 5988 | $formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
| 5989 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
| 5989 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
|
| 5990 | 5990 | $formconfirm .= ' |
| 5991 | 5991 | $(document).ready(function () { |
| 5992 | 5992 | $(".confirmvalidatebutton").on("click", function() { |
@@ -5998,7 +5998,7 @@ discard block |
||
| 5998 | 5998 | }); |
| 5999 | 5999 | }); |
| 6000 | 6000 | '; |
| 6001 | - $formconfirm .= '</script>' . "\n"; |
|
| 6001 | + $formconfirm .= '</script>'."\n"; |
|
| 6002 | 6002 | } |
| 6003 | 6003 | |
| 6004 | 6004 | $formconfirm .= "<!-- end formconfirm -->\n"; |
@@ -6030,8 +6030,8 @@ discard block |
||
| 6030 | 6030 | // phpcs:enable |
| 6031 | 6031 | global $langs; |
| 6032 | 6032 | |
| 6033 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
| 6034 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 6033 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
| 6034 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 6035 | 6035 | |
| 6036 | 6036 | $out = ''; |
| 6037 | 6037 | |
@@ -6039,11 +6039,11 @@ discard block |
||
| 6039 | 6039 | |
| 6040 | 6040 | $langs->load("project"); |
| 6041 | 6041 | if ($htmlname != "none") { |
| 6042 | - $out .= '<form method="post" action="' . $page . '">'; |
|
| 6042 | + $out .= '<form method="post" action="'.$page.'">'; |
|
| 6043 | 6043 | $out .= '<input type="hidden" name="action" value="classin">'; |
| 6044 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6044 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6045 | 6045 | $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
| 6046 | - $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
| 6046 | + $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
| 6047 | 6047 | $out .= '</form>'; |
| 6048 | 6048 | } else { |
| 6049 | 6049 | $out .= '<span class="project_head_block">'; |
@@ -6052,7 +6052,7 @@ discard block |
||
| 6052 | 6052 | $projet->fetch($selected); |
| 6053 | 6053 | $out .= $projet->getNomUrl(0, '', 1); |
| 6054 | 6054 | } else { |
| 6055 | - $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
| 6055 | + $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
|
| 6056 | 6056 | } |
| 6057 | 6057 | $out .= '</span>'; |
| 6058 | 6058 | } |
@@ -6089,14 +6089,14 @@ discard block |
||
| 6089 | 6089 | $out = ''; |
| 6090 | 6090 | |
| 6091 | 6091 | if ($htmlname != "none") { |
| 6092 | - $out .= '<form method="POST" action="' . $page . '">'; |
|
| 6092 | + $out .= '<form method="POST" action="'.$page.'">'; |
|
| 6093 | 6093 | $out .= '<input type="hidden" name="action" value="setconditions">'; |
| 6094 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6094 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6095 | 6095 | if ($type) { |
| 6096 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
| 6096 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
|
| 6097 | 6097 | } |
| 6098 | 6098 | $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
| 6099 | - $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
| 6099 | + $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
| 6100 | 6100 | $out .= '</form>'; |
| 6101 | 6101 | } else { |
| 6102 | 6102 | if ($selected) { |
@@ -6141,12 +6141,12 @@ discard block |
||
| 6141 | 6141 | // phpcs:enable |
| 6142 | 6142 | global $langs; |
| 6143 | 6143 | if ($htmlname != "none") { |
| 6144 | - print '<form method="post" action="' . $page . '">'; |
|
| 6144 | + print '<form method="post" action="'.$page.'">'; |
|
| 6145 | 6145 | print '<input type="hidden" name="action" value="setavailability">'; |
| 6146 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6146 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6147 | 6147 | $this->selectAvailabilityDelay($selected, $htmlname, '', $addempty); |
| 6148 | - print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
| 6149 | - print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
| 6148 | + print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
| 6149 | + print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
|
| 6150 | 6150 | print '</form>'; |
| 6151 | 6151 | } else { |
| 6152 | 6152 | if ($selected) { |
@@ -6172,11 +6172,11 @@ discard block |
||
| 6172 | 6172 | { |
| 6173 | 6173 | global $langs; |
| 6174 | 6174 | if ($htmlname != "none") { |
| 6175 | - print '<form method="post" action="' . $page . '">'; |
|
| 6175 | + print '<form method="post" action="'.$page.'">'; |
|
| 6176 | 6176 | print '<input type="hidden" name="action" value="setdemandreason">'; |
| 6177 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6177 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6178 | 6178 | $this->selectInputReason($selected, $htmlname, '-1', $addempty); |
| 6179 | - print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
| 6179 | + print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
| 6180 | 6180 | print '</form>'; |
| 6181 | 6181 | } else { |
| 6182 | 6182 | if ($selected) { |
@@ -6216,17 +6216,17 @@ discard block |
||
| 6216 | 6216 | $ret = ''; |
| 6217 | 6217 | |
| 6218 | 6218 | if ($htmlname != "none") { |
| 6219 | - $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
|
| 6220 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
|
| 6221 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6219 | + $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
| 6220 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
| 6221 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6222 | 6222 | if ($type) { |
| 6223 | - $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
| 6223 | + $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
|
| 6224 | 6224 | } |
| 6225 | 6225 | $ret .= '<table class="nobordernopadding">'; |
| 6226 | 6226 | $ret .= '<tr><td>'; |
| 6227 | - $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
| 6227 | + $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
|
| 6228 | 6228 | $ret .= '</td>'; |
| 6229 | - $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
| 6229 | + $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
|
| 6230 | 6230 | $ret .= '</tr></table></form>'; |
| 6231 | 6231 | } else { |
| 6232 | 6232 | if ($displayhour) { |
@@ -6261,15 +6261,15 @@ discard block |
||
| 6261 | 6261 | global $langs; |
| 6262 | 6262 | |
| 6263 | 6263 | if ($htmlname != "none") { |
| 6264 | - print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
|
| 6265 | - print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
|
| 6266 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6264 | + print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
| 6265 | + print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
| 6266 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6267 | 6267 | print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
| 6268 | - print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 6268 | + print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 6269 | 6269 | print '</form>'; |
| 6270 | 6270 | } else { |
| 6271 | 6271 | if ($selected) { |
| 6272 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
| 6272 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
|
| 6273 | 6273 | $theuser = new User($this->db); |
| 6274 | 6274 | $theuser->fetch($selected); |
| 6275 | 6275 | print $theuser->getNomUrl(1); |
@@ -6302,14 +6302,14 @@ discard block |
||
| 6302 | 6302 | |
| 6303 | 6303 | $out = ''; |
| 6304 | 6304 | if ($htmlname != "none") { |
| 6305 | - $out .= '<form method="POST" action="' . $page . '">'; |
|
| 6305 | + $out .= '<form method="POST" action="'.$page.'">'; |
|
| 6306 | 6306 | $out .= '<input type="hidden" name="action" value="setmode">'; |
| 6307 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6307 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6308 | 6308 | if ($type) { |
| 6309 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
| 6309 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
|
| 6310 | 6310 | } |
| 6311 | 6311 | $out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
| 6312 | - $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 6312 | + $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 6313 | 6313 | $out .= '</form>'; |
| 6314 | 6314 | } else { |
| 6315 | 6315 | if ($selected) { |
@@ -6342,11 +6342,11 @@ discard block |
||
| 6342 | 6342 | { |
| 6343 | 6343 | global $langs; |
| 6344 | 6344 | if ($htmlname != "none") { |
| 6345 | - print '<form method="POST" action="' . $page . '">'; |
|
| 6345 | + print '<form method="POST" action="'.$page.'">'; |
|
| 6346 | 6346 | print '<input type="hidden" name="action" value="settransportmode">'; |
| 6347 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6347 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6348 | 6348 | $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
| 6349 | - print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 6349 | + print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 6350 | 6350 | print '</form>'; |
| 6351 | 6351 | } else { |
| 6352 | 6352 | if ($selected) { |
@@ -6373,14 +6373,14 @@ discard block |
||
| 6373 | 6373 | // phpcs:enable |
| 6374 | 6374 | global $langs; |
| 6375 | 6375 | if ($htmlname != "none") { |
| 6376 | - print '<form method="POST" action="' . $page . '">'; |
|
| 6376 | + print '<form method="POST" action="'.$page.'">'; |
|
| 6377 | 6377 | print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
| 6378 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6378 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6379 | 6379 | print $this->selectMultiCurrency($selected, $htmlname, 0); |
| 6380 | - print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 6380 | + print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 6381 | 6381 | print '</form>'; |
| 6382 | 6382 | } else { |
| 6383 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
| 6383 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
| 6384 | 6384 | print !empty($selected) ? currency_name($selected, 1) : ' '; |
| 6385 | 6385 | } |
| 6386 | 6386 | } |
@@ -6402,22 +6402,22 @@ discard block |
||
| 6402 | 6402 | global $langs, $mysoc, $conf; |
| 6403 | 6403 | |
| 6404 | 6404 | if ($htmlname != "none") { |
| 6405 | - print '<form method="POST" action="' . $page . '">'; |
|
| 6405 | + print '<form method="POST" action="'.$page.'">'; |
|
| 6406 | 6406 | print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
| 6407 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6408 | - print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
| 6407 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6408 | + print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
|
| 6409 | 6409 | print '<select name="calculation_mode" id="calculation_mode">'; |
| 6410 | - print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
|
| 6411 | - print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
| 6410 | + print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
| 6411 | + print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
|
| 6412 | 6412 | print '</select> '; |
| 6413 | 6413 | print ajax_combobox("calculation_mode"); |
| 6414 | - print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 6414 | + print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 6415 | 6415 | print '</form>'; |
| 6416 | 6416 | } else { |
| 6417 | 6417 | if (!empty($rate)) { |
| 6418 | 6418 | print price($rate, 1, $langs, 0, 0); |
| 6419 | 6419 | if ($currency && $rate != 1) { |
| 6420 | - print ' <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>'; |
|
| 6420 | + print ' <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>'; |
|
| 6421 | 6421 | } |
| 6422 | 6422 | } else { |
| 6423 | 6423 | print 1; |
@@ -6447,9 +6447,9 @@ discard block |
||
| 6447 | 6447 | // phpcs:enable |
| 6448 | 6448 | global $conf, $langs; |
| 6449 | 6449 | if ($htmlname != "none") { |
| 6450 | - print '<form method="post" action="' . $page . '">'; |
|
| 6450 | + print '<form method="post" action="'.$page.'">'; |
|
| 6451 | 6451 | print '<input type="hidden" name="action" value="setabsolutediscount">'; |
| 6452 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6452 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6453 | 6453 | print '<div class="inline-block">'; |
| 6454 | 6454 | if (!empty($discount_type)) { |
| 6455 | 6455 | if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
@@ -6487,24 +6487,24 @@ discard block |
||
| 6487 | 6487 | print '</div>'; |
| 6488 | 6488 | if (empty($hidelist)) { |
| 6489 | 6489 | print '<div class="inline-block" style="padding-right: 10px">'; |
| 6490 | - $newfilter = 'discount_type=' . intval($discount_type); |
|
| 6490 | + $newfilter = 'discount_type='.intval($discount_type); |
|
| 6491 | 6491 | if (!empty($discount_type)) { |
| 6492 | 6492 | $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
| 6493 | 6493 | } else { |
| 6494 | 6494 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
| 6495 | 6495 | } |
| 6496 | 6496 | if ($filter) { |
| 6497 | - $newfilter .= ' AND (' . $filter . ')'; |
|
| 6497 | + $newfilter .= ' AND ('.$filter.')'; |
|
| 6498 | 6498 | } |
| 6499 | 6499 | // output the combo of discounts |
| 6500 | 6500 | $nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue); |
| 6501 | 6501 | if ($nbqualifiedlines > 0) { |
| 6502 | - print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
| 6502 | + print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
|
| 6503 | 6503 | if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
| 6504 | - print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
| 6504 | + print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
|
| 6505 | 6505 | } |
| 6506 | 6506 | if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
| 6507 | - print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
| 6507 | + print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
|
| 6508 | 6508 | } |
| 6509 | 6509 | |
| 6510 | 6510 | print '>'; |
@@ -6544,23 +6544,23 @@ discard block |
||
| 6544 | 6544 | global $langs; |
| 6545 | 6545 | |
| 6546 | 6546 | if ($htmlname != "none") { |
| 6547 | - print '<form method="post" action="' . $page . '">'; |
|
| 6547 | + print '<form method="post" action="'.$page.'">'; |
|
| 6548 | 6548 | print '<input type="hidden" name="action" value="set_contact">'; |
| 6549 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6549 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6550 | 6550 | print '<table class="nobordernopadding">'; |
| 6551 | 6551 | print '<tr><td>'; |
| 6552 | 6552 | print $this->selectcontacts($societe->id, $selected, $htmlname); |
| 6553 | 6553 | $num = $this->num; |
| 6554 | 6554 | if ($num == 0) { |
| 6555 | 6555 | $addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
| 6556 | - print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
| 6556 | + print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
|
| 6557 | 6557 | } |
| 6558 | 6558 | print '</td>'; |
| 6559 | - print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
| 6559 | + print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
|
| 6560 | 6560 | print '</tr></table></form>'; |
| 6561 | 6561 | } else { |
| 6562 | 6562 | if ($selected) { |
| 6563 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 6563 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 6564 | 6564 | $contact = new Contact($this->db); |
| 6565 | 6565 | $contact->fetch($selected); |
| 6566 | 6566 | print $contact->getFullName($langs); |
@@ -6595,20 +6595,20 @@ discard block |
||
| 6595 | 6595 | |
| 6596 | 6596 | $out = ''; |
| 6597 | 6597 | if ($htmlname != "none") { |
| 6598 | - $out .= '<form method="post" action="' . $page . '">'; |
|
| 6598 | + $out .= '<form method="post" action="'.$page.'">'; |
|
| 6599 | 6599 | $out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
| 6600 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 6600 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 6601 | 6601 | $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
| 6602 | - $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 6602 | + $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 6603 | 6603 | $out .= '</form>'; |
| 6604 | 6604 | } else { |
| 6605 | 6605 | if ($selected) { |
| 6606 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 6606 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 6607 | 6607 | $soc = new Societe($this->db); |
| 6608 | 6608 | $soc->fetch($selected); |
| 6609 | 6609 | $out .= $soc->getNomUrl(0, ''); |
| 6610 | 6610 | } else { |
| 6611 | - $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
| 6611 | + $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
|
| 6612 | 6612 | } |
| 6613 | 6613 | } |
| 6614 | 6614 | |
@@ -6658,22 +6658,22 @@ discard block |
||
| 6658 | 6658 | $selected = 'EUR'; // Pour compatibilite |
| 6659 | 6659 | } |
| 6660 | 6660 | |
| 6661 | - $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 6661 | + $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 6662 | 6662 | if ($useempty) { |
| 6663 | 6663 | $out .= '<option value="-1" selected></option>'; |
| 6664 | 6664 | } |
| 6665 | 6665 | foreach ($langs->cache_currencies as $code_iso => $currency) { |
| 6666 | 6666 | $labeltoshow = $currency['label']; |
| 6667 | 6667 | if ($mode == 1) { |
| 6668 | - $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
| 6668 | + $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
|
| 6669 | 6669 | } else { |
| 6670 | - $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
| 6670 | + $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
|
| 6671 | 6671 | } |
| 6672 | 6672 | |
| 6673 | 6673 | if ($selected && $selected == $code_iso) { |
| 6674 | - $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
| 6674 | + $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
|
| 6675 | 6675 | } else { |
| 6676 | - $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
| 6676 | + $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
|
| 6677 | 6677 | } |
| 6678 | 6678 | $out .= $labeltoshow; |
| 6679 | 6679 | $out .= '</option>'; |
@@ -6684,7 +6684,7 @@ discard block |
||
| 6684 | 6684 | } |
| 6685 | 6685 | |
| 6686 | 6686 | // Make select dynamic |
| 6687 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 6687 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 6688 | 6688 | $out .= ajax_combobox($htmlname); |
| 6689 | 6689 | |
| 6690 | 6690 | return $out; |
@@ -6710,10 +6710,10 @@ discard block |
||
| 6710 | 6710 | |
| 6711 | 6711 | $TCurrency = array(); |
| 6712 | 6712 | |
| 6713 | - $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
|
| 6714 | - $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
| 6713 | + $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
| 6714 | + $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
|
| 6715 | 6715 | if ($filter) { |
| 6716 | - $sql .= " AND " . $filter; |
|
| 6716 | + $sql .= " AND ".$filter; |
|
| 6717 | 6717 | } |
| 6718 | 6718 | $resql = $this->db->query($sql); |
| 6719 | 6719 | if ($resql) { |
@@ -6723,7 +6723,7 @@ discard block |
||
| 6723 | 6723 | } |
| 6724 | 6724 | |
| 6725 | 6725 | $out = ''; |
| 6726 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 6726 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 6727 | 6727 | if ($useempty) { |
| 6728 | 6728 | $out .= '<option value=""> </option>'; |
| 6729 | 6729 | } |
@@ -6735,13 +6735,13 @@ discard block |
||
| 6735 | 6735 | foreach ($langs->cache_currencies as $code_iso => $currency) { |
| 6736 | 6736 | if (isset($TCurrency[$code_iso])) { |
| 6737 | 6737 | if (!empty($selected) && $selected == $code_iso) { |
| 6738 | - $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
| 6738 | + $out .= '<option value="'.$code_iso.'" selected="selected">'; |
|
| 6739 | 6739 | } else { |
| 6740 | - $out .= '<option value="' . $code_iso . '">'; |
|
| 6740 | + $out .= '<option value="'.$code_iso.'">'; |
|
| 6741 | 6741 | } |
| 6742 | 6742 | |
| 6743 | 6743 | $out .= $currency['label']; |
| 6744 | - $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
| 6744 | + $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
|
| 6745 | 6745 | $out .= '</option>'; |
| 6746 | 6746 | } |
| 6747 | 6747 | } |
@@ -6750,7 +6750,7 @@ discard block |
||
| 6750 | 6750 | $out .= '</select>'; |
| 6751 | 6751 | |
| 6752 | 6752 | // Make select dynamic |
| 6753 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 6753 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 6754 | 6754 | $out .= ajax_combobox($htmlname); |
| 6755 | 6755 | |
| 6756 | 6756 | return $out; |
@@ -6781,7 +6781,7 @@ discard block |
||
| 6781 | 6781 | $sql .= " WHERE t.fk_pays = c.rowid"; |
| 6782 | 6782 | $sql .= " AND t.active > 0"; |
| 6783 | 6783 | $sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
| 6784 | - $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
| 6784 | + $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
|
| 6785 | 6785 | $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
| 6786 | 6786 | |
| 6787 | 6787 | $resql = $this->db->query($sql); |
@@ -6793,30 +6793,30 @@ discard block |
||
| 6793 | 6793 | |
| 6794 | 6794 | $tmparray = array(); |
| 6795 | 6795 | $tmparray['rowid'] = $obj->rowid; |
| 6796 | - $tmparray['type_vat'] = $obj->type_vat; |
|
| 6797 | - $tmparray['code'] = $obj->code; |
|
| 6796 | + $tmparray['type_vat'] = $obj->type_vat; |
|
| 6797 | + $tmparray['code'] = $obj->code; |
|
| 6798 | 6798 | $tmparray['txtva'] = $obj->taux; |
| 6799 | - $tmparray['nprtva'] = $obj->recuperableonly; |
|
| 6799 | + $tmparray['nprtva'] = $obj->recuperableonly; |
|
| 6800 | 6800 | $tmparray['localtax1'] = $obj->localtax1; |
| 6801 | 6801 | $tmparray['localtax1_type'] = $obj->localtax1_type; |
| 6802 | 6802 | $tmparray['localtax2'] = $obj->localtax2; |
| 6803 | 6803 | $tmparray['localtax2_type'] = $obj->localtax1_type; |
| 6804 | - $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
|
| 6805 | - $tmparray['labelallrates'] = $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
| 6804 | + $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
| 6805 | + $tmparray['labelallrates'] = $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
|
| 6806 | 6806 | $positiverates = ''; |
| 6807 | 6807 | if ($obj->taux) { |
| 6808 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
| 6808 | + $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
|
| 6809 | 6809 | } |
| 6810 | 6810 | if ($obj->localtax1) { |
| 6811 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
| 6811 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
|
| 6812 | 6812 | } |
| 6813 | 6813 | if ($obj->localtax2) { |
| 6814 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
| 6814 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
|
| 6815 | 6815 | } |
| 6816 | 6816 | if (empty($positiverates)) { |
| 6817 | 6817 | $positiverates = '0'; |
| 6818 | 6818 | } |
| 6819 | - $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
| 6819 | + $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
|
| 6820 | 6820 | |
| 6821 | 6821 | $this->cache_vatrates[$obj->rowid] = $tmparray; |
| 6822 | 6822 | } |
@@ -6836,7 +6836,7 @@ discard block |
||
| 6836 | 6836 | return -1; |
| 6837 | 6837 | } |
| 6838 | 6838 | } else { |
| 6839 | - $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
| 6839 | + $this->error = '<span class="error">'.$this->db->error().'</span>'; |
|
| 6840 | 6840 | return -2; |
| 6841 | 6841 | } |
| 6842 | 6842 | } |
@@ -6889,9 +6889,9 @@ discard block |
||
| 6889 | 6889 | // Check parameters |
| 6890 | 6890 | if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
| 6891 | 6891 | if ($societe_vendeuse->id == $mysoc->id) { |
| 6892 | - $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
| 6892 | + $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
|
| 6893 | 6893 | } else { |
| 6894 | - $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
| 6894 | + $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
|
| 6895 | 6895 | } |
| 6896 | 6896 | return $return; |
| 6897 | 6897 | } |
@@ -6903,12 +6903,12 @@ discard block |
||
| 6903 | 6903 | // Define list of countries to use to search VAT rates to show |
| 6904 | 6904 | // First we defined code_country to use to find list |
| 6905 | 6905 | if (is_object($societe_vendeuse)) { |
| 6906 | - $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
| 6906 | + $code_country = "'".$societe_vendeuse->country_code."'"; |
|
| 6907 | 6907 | } else { |
| 6908 | - $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
| 6908 | + $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
|
| 6909 | 6909 | } |
| 6910 | 6910 | if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
| 6911 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
| 6911 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
| 6912 | 6912 | // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
| 6913 | 6913 | // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
| 6914 | 6914 | $selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
@@ -6918,27 +6918,27 @@ discard block |
||
| 6918 | 6918 | if ($type == 1) { // We know product is a service |
| 6919 | 6919 | switch ($selectVatComboMode) { |
| 6920 | 6920 | case '1': |
| 6921 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
| 6921 | + $code_country .= ",'".$societe_acheteuse->country_code."'"; |
|
| 6922 | 6922 | break; |
| 6923 | 6923 | case '2': |
| 6924 | - $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
| 6924 | + $code_country = "'".$societe_acheteuse->country_code."'"; |
|
| 6925 | 6925 | break; |
| 6926 | 6926 | } |
| 6927 | 6927 | } |
| 6928 | 6928 | } elseif (!$idprod) { // We don't know type of product |
| 6929 | 6929 | switch ($selectVatComboMode) { |
| 6930 | 6930 | case '1': |
| 6931 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
| 6931 | + $code_country .= ",'".$societe_acheteuse->country_code."'"; |
|
| 6932 | 6932 | break; |
| 6933 | 6933 | case '2': |
| 6934 | - $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
| 6934 | + $code_country = "'".$societe_acheteuse->country_code."'"; |
|
| 6935 | 6935 | break; |
| 6936 | 6936 | } |
| 6937 | 6937 | } else { |
| 6938 | 6938 | $prodstatic = new Product($this->db); |
| 6939 | 6939 | $prodstatic->fetch($idprod); |
| 6940 | 6940 | if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
| 6941 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
| 6941 | + $code_country .= ",'".$societe_acheteuse->country_code."'"; |
|
| 6942 | 6942 | } |
| 6943 | 6943 | } |
| 6944 | 6944 | } |
@@ -7000,13 +7000,13 @@ discard block |
||
| 7000 | 7000 | // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
| 7001 | 7001 | // of using supplier invoices (this is a very bad idea !) |
| 7002 | 7002 | if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
| 7003 | - $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
| 7003 | + $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
|
| 7004 | 7004 | $disabled = true; |
| 7005 | 7005 | } |
| 7006 | 7006 | } |
| 7007 | 7007 | |
| 7008 | 7008 | if (!$options_only) { |
| 7009 | - $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
| 7009 | + $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
|
| 7010 | 7010 | } |
| 7011 | 7011 | |
| 7012 | 7012 | $selectedfound = false; |
@@ -7020,13 +7020,13 @@ discard block |
||
| 7020 | 7020 | $key = $rate['txtva']; |
| 7021 | 7021 | $key .= $rate['nprtva'] ? '*' : ''; |
| 7022 | 7022 | if ($mode > 0 && $rate['code']) { |
| 7023 | - $key .= ' (' . $rate['code'] . ')'; |
|
| 7023 | + $key .= ' ('.$rate['code'].')'; |
|
| 7024 | 7024 | } |
| 7025 | 7025 | if ($mode < 0) { |
| 7026 | 7026 | $key = $rate['rowid']; |
| 7027 | 7027 | } |
| 7028 | 7028 | |
| 7029 | - $return .= '<option value="' . $key . '"'; |
|
| 7029 | + $return .= '<option value="'.$key.'"'; |
|
| 7030 | 7030 | if (!$selectedfound) { |
| 7031 | 7031 | if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
| 7032 | 7032 | if ($defaultcode == $rate['code']) { |
@@ -7097,7 +7097,7 @@ discard block |
||
| 7097 | 7097 | public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = 0, $addplusone = '', $adddateof = '') |
| 7098 | 7098 | { |
| 7099 | 7099 | // phpcs:enable |
| 7100 | - dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
| 7100 | + dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
| 7101 | 7101 | $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
| 7102 | 7102 | if (!empty($nooutput)) { |
| 7103 | 7103 | return $retstring; |
@@ -7126,11 +7126,11 @@ discard block |
||
| 7126 | 7126 | { |
| 7127 | 7127 | global $langs; |
| 7128 | 7128 | |
| 7129 | - $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
| 7129 | + $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
| 7130 | 7130 | if ($forcenewline) { |
| 7131 | 7131 | $ret .= '<br>'; |
| 7132 | 7132 | } |
| 7133 | - $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
| 7133 | + $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
| 7134 | 7134 | return $ret; |
| 7135 | 7135 | } |
| 7136 | 7136 | |
@@ -7197,7 +7197,7 @@ discard block |
||
| 7197 | 7197 | $orig_set_time = $set_time; |
| 7198 | 7198 | |
| 7199 | 7199 | if ($set_time === '' && $emptydate == 0) { |
| 7200 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 7200 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 7201 | 7201 | if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
| 7202 | 7202 | $set_time = dol_now($gm); |
| 7203 | 7203 | } else { |
@@ -7269,38 +7269,38 @@ discard block |
||
| 7269 | 7269 | // Calendrier popup version eldy |
| 7270 | 7270 | if ($usecalendar == "eldy") { |
| 7271 | 7271 | // Input area to enter date manually |
| 7272 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"'; |
|
| 7272 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
|
| 7273 | 7273 | $retstring .= ($disabled ? ' disabled' : ''); |
| 7274 | - $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
| 7274 | + $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
| 7275 | 7275 | $retstring .= ' autocomplete="off">'; |
| 7276 | 7276 | |
| 7277 | 7277 | // Icon calendar |
| 7278 | 7278 | $retstringbuttom = ''; |
| 7279 | 7279 | if (!$disabled) { |
| 7280 | - $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
|
| 7281 | - $base = DOL_URL_ROOT . '/core/'; |
|
| 7282 | - $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
|
| 7283 | - $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
| 7280 | + $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
| 7281 | + $base = DOL_URL_ROOT.'/core/'; |
|
| 7282 | + $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
| 7283 | + $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
|
| 7284 | 7284 | } else { |
| 7285 | - $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
| 7285 | + $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
| 7286 | 7286 | } |
| 7287 | - $retstring = $retstringbuttom . $retstring; |
|
| 7287 | + $retstring = $retstringbuttom.$retstring; |
|
| 7288 | 7288 | |
| 7289 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
|
| 7290 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
|
| 7291 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
| 7289 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
| 7290 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
| 7291 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
|
| 7292 | 7292 | } elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
| 7293 | 7293 | if (!$disabled && $usecalendar != 'html') { |
| 7294 | 7294 | // Output javascript for datepicker |
| 7295 | 7295 | $minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
| 7296 | 7296 | $maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
| 7297 | 7297 | |
| 7298 | - $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
|
| 7299 | - $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
|
| 7300 | - dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
| 7298 | + $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
| 7299 | + $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
| 7300 | + dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
|
| 7301 | 7301 | autoclose: true, |
| 7302 | 7302 | todayHighlight: true, |
| 7303 | - yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
| 7303 | + yearRange: '" . $minYear.":".$maxYear."',"; |
|
| 7304 | 7304 | if (!empty($conf->dol_use_jmobile)) { |
| 7305 | 7305 | $retstring .= " |
| 7306 | 7306 | beforeShow: function (input, datePicker) { |
@@ -7313,10 +7313,10 @@ discard block |
||
| 7313 | 7313 | } |
| 7314 | 7314 | // Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php |
| 7315 | 7315 | if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
| 7316 | - $buttonImage = $calendarpicto ?: DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png"; |
|
| 7316 | + $buttonImage = $calendarpicto ?: DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png"; |
|
| 7317 | 7317 | $retstring .= " |
| 7318 | 7318 | showOn: 'button', /* both has problem with autocompletion */ |
| 7319 | - buttonImage: '" . $buttonImage . "', |
|
| 7319 | + buttonImage: '" . $buttonImage."', |
|
| 7320 | 7320 | buttonImageOnly: true"; |
| 7321 | 7321 | } |
| 7322 | 7322 | $retstring .= " |
@@ -7328,46 +7328,46 @@ discard block |
||
| 7328 | 7328 | $retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
| 7329 | 7329 | $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
| 7330 | 7330 | $retstring .= ($disabled ? ' disabled' : ''); |
| 7331 | - $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
|
| 7332 | - $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
| 7331 | + $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
| 7332 | + $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
| 7333 | 7333 | $retstring .= ' autocomplete="off">'; |
| 7334 | 7334 | |
| 7335 | 7335 | // Icone calendrier |
| 7336 | 7336 | if ($disabled) { |
| 7337 | - $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
| 7338 | - $retstring = $retstringbutton . $retstring; |
|
| 7337 | + $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
| 7338 | + $retstring = $retstringbutton.$retstring; |
|
| 7339 | 7339 | } |
| 7340 | 7340 | |
| 7341 | 7341 | $retstring .= '</div>'; |
| 7342 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
|
| 7343 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
|
| 7344 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
| 7342 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
| 7343 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
| 7344 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
|
| 7345 | 7345 | } else { |
| 7346 | 7346 | $retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
| 7347 | 7347 | } |
| 7348 | 7348 | } else { |
| 7349 | 7349 | // Show date with combo selects |
| 7350 | 7350 | // Day |
| 7351 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
| 7351 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
|
| 7352 | 7352 | |
| 7353 | 7353 | if ($emptydate || $set_time == -1) { |
| 7354 | 7354 | $retstring .= '<option value="0" selected> </option>'; |
| 7355 | 7355 | } |
| 7356 | 7356 | |
| 7357 | 7357 | for ($day = 1; $day <= 31; $day++) { |
| 7358 | - $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
| 7358 | + $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
|
| 7359 | 7359 | } |
| 7360 | 7360 | |
| 7361 | 7361 | $retstring .= "</select>"; |
| 7362 | 7362 | |
| 7363 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
| 7363 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
|
| 7364 | 7364 | if ($emptydate || $set_time == -1) { |
| 7365 | 7365 | $retstring .= '<option value="0" selected> </option>'; |
| 7366 | 7366 | } |
| 7367 | 7367 | |
| 7368 | 7368 | // Month |
| 7369 | 7369 | for ($month = 1; $month <= 12; $month++) { |
| 7370 | - $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
| 7370 | + $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
|
| 7371 | 7371 | $retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
| 7372 | 7372 | $retstring .= "</option>"; |
| 7373 | 7373 | } |
@@ -7375,13 +7375,13 @@ discard block |
||
| 7375 | 7375 | |
| 7376 | 7376 | // Year |
| 7377 | 7377 | if ($emptydate || $set_time == -1) { |
| 7378 | - $retstring .= '<input' . ($disabled ? ' disabled' : '') . ' placeholder="' . dol_escape_htmltag($langs->trans("Year")) . '" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">'; |
|
| 7378 | + $retstring .= '<input'.($disabled ? ' disabled' : '').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'; |
|
| 7379 | 7379 | } else { |
| 7380 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
| 7380 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
|
| 7381 | 7381 | |
| 7382 | 7382 | $syear = (int) $syear; |
| 7383 | 7383 | for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
| 7384 | - $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
| 7384 | + $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
|
| 7385 | 7385 | } |
| 7386 | 7386 | $retstring .= "</select>\n"; |
| 7387 | 7387 | } |
@@ -7405,15 +7405,15 @@ discard block |
||
| 7405 | 7405 | } |
| 7406 | 7406 | } |
| 7407 | 7407 | // Show hour |
| 7408 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
| 7408 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
|
| 7409 | 7409 | if ($emptyhours) { |
| 7410 | 7410 | $retstring .= '<option value="-1"> </option>'; |
| 7411 | 7411 | } |
| 7412 | 7412 | for ($hour = $hourstart; $hour < $hourend; $hour++) { |
| 7413 | 7413 | if (strlen($hour) < 2) { |
| 7414 | - $hour = "0" . $hour; |
|
| 7414 | + $hour = "0".$hour; |
|
| 7415 | 7415 | } |
| 7416 | - $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
| 7416 | + $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
|
| 7417 | 7417 | //$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
| 7418 | 7418 | $retstring .= '</option>'; |
| 7419 | 7419 | } |
@@ -7426,17 +7426,17 @@ discard block |
||
| 7426 | 7426 | |
| 7427 | 7427 | if ($m) { |
| 7428 | 7428 | // Show minutes |
| 7429 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
| 7429 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
|
| 7430 | 7430 | if ($emptyhours) { |
| 7431 | 7431 | $retstring .= '<option value="-1"> </option>'; |
| 7432 | 7432 | } |
| 7433 | 7433 | for ($min = 0; $min < 60; $min += $stepminutes) { |
| 7434 | 7434 | $min_str = sprintf("%02d", $min); |
| 7435 | - $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
| 7435 | + $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
|
| 7436 | 7436 | } |
| 7437 | 7437 | $retstring .= '</select>'; |
| 7438 | 7438 | |
| 7439 | - $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
| 7439 | + $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
|
| 7440 | 7440 | } |
| 7441 | 7441 | |
| 7442 | 7442 | if ($d && $h) { |
@@ -7459,10 +7459,10 @@ discard block |
||
| 7459 | 7459 | |
| 7460 | 7460 | // Generate the date part, depending on the use or not of the javascript calendar |
| 7461 | 7461 | if ($addnowlink == 1) { // server time expressed in user time setup |
| 7462 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
|
| 7463 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
|
| 7464 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
|
| 7465 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
| 7462 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
| 7463 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
| 7464 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
| 7465 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
|
| 7466 | 7466 | } elseif ($addnowlink == 2) { |
| 7467 | 7467 | /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
| 7468 | 7468 | * This break application for foreign languages. |
@@ -7471,10 +7471,10 @@ discard block |
||
| 7471 | 7471 | $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
| 7472 | 7472 | $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
| 7473 | 7473 | */ |
| 7474 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
|
| 7475 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
|
| 7476 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
|
| 7477 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
| 7474 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
| 7475 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
| 7476 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
| 7477 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
|
| 7478 | 7478 | } |
| 7479 | 7479 | /*if ($usecalendar == "eldy") |
| 7480 | 7480 | { |
@@ -7494,11 +7494,11 @@ discard block |
||
| 7494 | 7494 | } |
| 7495 | 7495 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
| 7496 | 7496 | if ($addnowlink == 1) { |
| 7497 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
| 7498 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
| 7497 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
| 7498 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
|
| 7499 | 7499 | } elseif ($addnowlink == 2) { |
| 7500 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
|
| 7501 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
| 7500 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
| 7501 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
|
| 7502 | 7502 | } |
| 7503 | 7503 | |
| 7504 | 7504 | if ($fullday) { |
@@ -7512,11 +7512,11 @@ discard block |
||
| 7512 | 7512 | } |
| 7513 | 7513 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
| 7514 | 7514 | if ($addnowlink == 1) { |
| 7515 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
| 7516 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
| 7515 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
| 7516 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
|
| 7517 | 7517 | } elseif ($addnowlink == 2) { |
| 7518 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
|
| 7519 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
| 7518 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
| 7519 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
|
| 7520 | 7520 | } |
| 7521 | 7521 | if ($fullday) { |
| 7522 | 7522 | $reset_scripts .= ' } '; |
@@ -7524,7 +7524,7 @@ discard block |
||
| 7524 | 7524 | } |
| 7525 | 7525 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
| 7526 | 7526 | if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
| 7527 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
| 7527 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
|
| 7528 | 7528 | $retstring .= $langs->trans("Now"); |
| 7529 | 7529 | $retstring .= '</button> '; |
| 7530 | 7530 | } |
@@ -7536,16 +7536,16 @@ discard block |
||
| 7536 | 7536 | $reset_scripts = ""; |
| 7537 | 7537 | |
| 7538 | 7538 | // Generate the date part, depending on the use or not of the javascript calendar |
| 7539 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
|
| 7540 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
|
| 7541 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
|
| 7542 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
| 7539 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
| 7540 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
| 7541 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
| 7542 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
|
| 7543 | 7543 | // Update the hour part |
| 7544 | 7544 | if ($h) { |
| 7545 | 7545 | if ($fullday) { |
| 7546 | 7546 | $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
| 7547 | 7547 | } |
| 7548 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
| 7548 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
| 7549 | 7549 | if ($fullday) { |
| 7550 | 7550 | $reset_scripts .= ' } '; |
| 7551 | 7551 | } |
@@ -7555,14 +7555,14 @@ discard block |
||
| 7555 | 7555 | if ($fullday) { |
| 7556 | 7556 | $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
| 7557 | 7557 | } |
| 7558 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
| 7558 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
| 7559 | 7559 | if ($fullday) { |
| 7560 | 7560 | $reset_scripts .= ' } '; |
| 7561 | 7561 | } |
| 7562 | 7562 | } |
| 7563 | 7563 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
| 7564 | 7564 | if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
| 7565 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
| 7565 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
|
| 7566 | 7566 | $retstring .= $langs->trans("DateStartPlusOne"); |
| 7567 | 7567 | $retstring .= '</button> '; |
| 7568 | 7568 | } |
@@ -7620,17 +7620,17 @@ discard block |
||
| 7620 | 7620 | unset($TDurationTypes[$value]); |
| 7621 | 7621 | } |
| 7622 | 7622 | |
| 7623 | - $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
| 7623 | + $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
|
| 7624 | 7624 | foreach ($TDurationTypes as $key => $typeduration) { |
| 7625 | - $retstring .= '<option value="' . $key . '"'; |
|
| 7625 | + $retstring .= '<option value="'.$key.'"'; |
|
| 7626 | 7626 | if ($key == $selected) { |
| 7627 | 7627 | $retstring .= " selected"; |
| 7628 | 7628 | } |
| 7629 | - $retstring .= ">" . $typeduration . "</option>"; |
|
| 7629 | + $retstring .= ">".$typeduration."</option>"; |
|
| 7630 | 7630 | } |
| 7631 | 7631 | $retstring .= "</select>"; |
| 7632 | 7632 | |
| 7633 | - $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
| 7633 | + $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
|
| 7634 | 7634 | |
| 7635 | 7635 | return $retstring; |
| 7636 | 7636 | } |
@@ -7662,30 +7662,30 @@ discard block |
||
| 7662 | 7662 | |
| 7663 | 7663 | // Hours |
| 7664 | 7664 | if ($iSecond != '') { |
| 7665 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 7665 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 7666 | 7666 | |
| 7667 | 7667 | $hourSelected = convertSecondToTime($iSecond, 'allhour'); |
| 7668 | 7668 | $minSelected = convertSecondToTime($iSecond, 'min'); |
| 7669 | 7669 | } |
| 7670 | 7670 | |
| 7671 | 7671 | if ($typehour == 'select') { |
| 7672 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
| 7672 | + $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
|
| 7673 | 7673 | for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
| 7674 | - $retstring .= '<option value="' . $hour . '"'; |
|
| 7674 | + $retstring .= '<option value="'.$hour.'"'; |
|
| 7675 | 7675 | if (is_numeric($hourSelected) && $hourSelected == $hour) { |
| 7676 | 7676 | $retstring .= " selected"; |
| 7677 | 7677 | } |
| 7678 | - $retstring .= ">" . $hour . "</option>"; |
|
| 7678 | + $retstring .= ">".$hour."</option>"; |
|
| 7679 | 7679 | } |
| 7680 | 7680 | $retstring .= "</select>"; |
| 7681 | 7681 | } elseif ($typehour == 'text' || $typehour == 'textselect') { |
| 7682 | - $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
| 7682 | + $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
|
| 7683 | 7683 | } else { |
| 7684 | 7684 | return 'BadValueForParameterTypeHour'; |
| 7685 | 7685 | } |
| 7686 | 7686 | |
| 7687 | 7687 | if ($typehour != 'text') { |
| 7688 | - $retstring .= ' ' . $langs->trans('HourShort'); |
|
| 7688 | + $retstring .= ' '.$langs->trans('HourShort'); |
|
| 7689 | 7689 | } else { |
| 7690 | 7690 | $retstring .= '<span class="">:</span>'; |
| 7691 | 7691 | } |
@@ -7700,21 +7700,21 @@ discard block |
||
| 7700 | 7700 | } |
| 7701 | 7701 | |
| 7702 | 7702 | if ($typehour == 'select' || $typehour == 'textselect') { |
| 7703 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
| 7703 | + $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
|
| 7704 | 7704 | for ($min = 0; $min <= 55; $min += 5) { |
| 7705 | - $retstring .= '<option value="' . $min . '"'; |
|
| 7705 | + $retstring .= '<option value="'.$min.'"'; |
|
| 7706 | 7706 | if (is_numeric($minSelected) && $minSelected == $min) { |
| 7707 | 7707 | $retstring .= ' selected'; |
| 7708 | 7708 | } |
| 7709 | - $retstring .= '>' . $min . '</option>'; |
|
| 7709 | + $retstring .= '>'.$min.'</option>'; |
|
| 7710 | 7710 | } |
| 7711 | 7711 | $retstring .= "</select>"; |
| 7712 | 7712 | } elseif ($typehour == 'text') { |
| 7713 | - $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
| 7713 | + $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
|
| 7714 | 7714 | } |
| 7715 | 7715 | |
| 7716 | 7716 | if ($typehour != 'text') { |
| 7717 | - $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
| 7717 | + $retstring .= ' '.$langs->trans('MinuteShort'); |
|
| 7718 | 7718 | } |
| 7719 | 7719 | |
| 7720 | 7720 | $retstring .= "</span>"; |
@@ -7762,7 +7762,7 @@ discard block |
||
| 7762 | 7762 | $placeholder = ''; |
| 7763 | 7763 | |
| 7764 | 7764 | if ($selected && empty($selected_input_value)) { |
| 7765 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
| 7765 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
| 7766 | 7766 | $tickettmpselect = new Ticket($this->db); |
| 7767 | 7767 | $tickettmpselect->fetch($selected); |
| 7768 | 7768 | $selected_input_value = $tickettmpselect->ref; |
@@ -7770,17 +7770,17 @@ discard block |
||
| 7770 | 7770 | } |
| 7771 | 7771 | |
| 7772 | 7772 | $urloption = ''; |
| 7773 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
| 7773 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
| 7774 | 7774 | |
| 7775 | 7775 | if (empty($hidelabel)) { |
| 7776 | - $out .= $langs->trans("RefOrLabel") . ' : '; |
|
| 7776 | + $out .= $langs->trans("RefOrLabel").' : '; |
|
| 7777 | 7777 | } elseif ($hidelabel > 1) { |
| 7778 | - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
| 7778 | + $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
|
| 7779 | 7779 | if ($hidelabel == 2) { |
| 7780 | 7780 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 7781 | 7781 | } |
| 7782 | 7782 | } |
| 7783 | - $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
| 7783 | + $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
|
| 7784 | 7784 | if ($hidelabel == 3) { |
| 7785 | 7785 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 7786 | 7786 | } |
@@ -7824,8 +7824,8 @@ discard block |
||
| 7824 | 7824 | |
| 7825 | 7825 | $sql = "SELECT "; |
| 7826 | 7826 | $sql .= $selectFields; |
| 7827 | - $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
|
| 7828 | - $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
| 7827 | + $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
| 7828 | + $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
|
| 7829 | 7829 | |
| 7830 | 7830 | // Add criteria on ref/label |
| 7831 | 7831 | if ($filterkey != '') { |
@@ -7841,7 +7841,7 @@ discard block |
||
| 7841 | 7841 | if ($i > 0) { |
| 7842 | 7842 | $sql .= " AND "; |
| 7843 | 7843 | } |
| 7844 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 7844 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 7845 | 7845 | $sql .= ")"; |
| 7846 | 7846 | $i++; |
| 7847 | 7847 | } |
@@ -7854,22 +7854,22 @@ discard block |
||
| 7854 | 7854 | $sql .= $this->db->plimit($limit, 0); |
| 7855 | 7855 | |
| 7856 | 7856 | // Build output string |
| 7857 | - dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
| 7857 | + dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
|
| 7858 | 7858 | $result = $this->db->query($sql); |
| 7859 | 7859 | if ($result) { |
| 7860 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
| 7861 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
| 7860 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
| 7861 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
|
| 7862 | 7862 | |
| 7863 | 7863 | $num = $this->db->num_rows($result); |
| 7864 | 7864 | |
| 7865 | 7865 | $events = array(); |
| 7866 | 7866 | |
| 7867 | 7867 | if (!$forcecombo) { |
| 7868 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 7868 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 7869 | 7869 | $out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT')); |
| 7870 | 7870 | } |
| 7871 | 7871 | |
| 7872 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 7872 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 7873 | 7873 | |
| 7874 | 7874 | $textifempty = ''; |
| 7875 | 7875 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
@@ -7886,7 +7886,7 @@ discard block |
||
| 7886 | 7886 | } |
| 7887 | 7887 | } |
| 7888 | 7888 | if ($showempty) { |
| 7889 | - $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
| 7889 | + $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
|
| 7890 | 7890 | } |
| 7891 | 7891 | |
| 7892 | 7892 | $i = 0; |
@@ -7941,13 +7941,13 @@ discard block |
||
| 7941 | 7941 | $outkey = $objp->rowid; |
| 7942 | 7942 | $outref = $objp->ref; |
| 7943 | 7943 | |
| 7944 | - $opt = '<option value="' . $objp->rowid . '"'; |
|
| 7944 | + $opt = '<option value="'.$objp->rowid.'"'; |
|
| 7945 | 7945 | $opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
| 7946 | 7946 | $opt .= '>'; |
| 7947 | 7947 | $opt .= $objp->ref; |
| 7948 | 7948 | $objRef = $objp->ref; |
| 7949 | 7949 | if (!empty($filterkey) && $filterkey != '') { |
| 7950 | - $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
| 7950 | + $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
|
| 7951 | 7951 | } |
| 7952 | 7952 | |
| 7953 | 7953 | $opt .= "</option>\n"; |
@@ -7988,7 +7988,7 @@ discard block |
||
| 7988 | 7988 | $placeholder = ''; |
| 7989 | 7989 | |
| 7990 | 7990 | if ($selected && empty($selected_input_value)) { |
| 7991 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 7991 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 7992 | 7992 | $projecttmpselect = new Project($this->db); |
| 7993 | 7993 | $projecttmpselect->fetch($selected); |
| 7994 | 7994 | $selected_input_value = $projecttmpselect->ref; |
@@ -7996,17 +7996,17 @@ discard block |
||
| 7996 | 7996 | } |
| 7997 | 7997 | |
| 7998 | 7998 | $urloption = ''; |
| 7999 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
| 7999 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
| 8000 | 8000 | |
| 8001 | 8001 | if (empty($hidelabel)) { |
| 8002 | - $out .= $langs->trans("RefOrLabel") . ' : '; |
|
| 8002 | + $out .= $langs->trans("RefOrLabel").' : '; |
|
| 8003 | 8003 | } elseif ($hidelabel > 1) { |
| 8004 | - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
| 8004 | + $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
|
| 8005 | 8005 | if ($hidelabel == 2) { |
| 8006 | 8006 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 8007 | 8007 | } |
| 8008 | 8008 | } |
| 8009 | - $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
| 8009 | + $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
|
| 8010 | 8010 | if ($hidelabel == 3) { |
| 8011 | 8011 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 8012 | 8012 | } |
@@ -8049,8 +8049,8 @@ discard block |
||
| 8049 | 8049 | |
| 8050 | 8050 | $sql = "SELECT "; |
| 8051 | 8051 | $sql .= $selectFields; |
| 8052 | - $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
|
| 8053 | - $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
| 8052 | + $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
| 8053 | + $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
|
| 8054 | 8054 | |
| 8055 | 8055 | // Add criteria on ref/label |
| 8056 | 8056 | if ($filterkey != '') { |
@@ -8066,7 +8066,7 @@ discard block |
||
| 8066 | 8066 | if ($i > 0) { |
| 8067 | 8067 | $sql .= " AND "; |
| 8068 | 8068 | } |
| 8069 | - $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 8069 | + $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 8070 | 8070 | $sql .= ""; |
| 8071 | 8071 | $i++; |
| 8072 | 8072 | } |
@@ -8079,22 +8079,22 @@ discard block |
||
| 8079 | 8079 | $sql .= $this->db->plimit($limit, 0); |
| 8080 | 8080 | |
| 8081 | 8081 | // Build output string |
| 8082 | - dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
| 8082 | + dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
|
| 8083 | 8083 | $result = $this->db->query($sql); |
| 8084 | 8084 | if ($result) { |
| 8085 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 8086 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
| 8085 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 8086 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
| 8087 | 8087 | |
| 8088 | 8088 | $num = $this->db->num_rows($result); |
| 8089 | 8089 | |
| 8090 | 8090 | $events = array(); |
| 8091 | 8091 | |
| 8092 | 8092 | if (!$forcecombo) { |
| 8093 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 8093 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 8094 | 8094 | $out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT')); |
| 8095 | 8095 | } |
| 8096 | 8096 | |
| 8097 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 8097 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 8098 | 8098 | |
| 8099 | 8099 | $textifempty = ''; |
| 8100 | 8100 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
@@ -8111,7 +8111,7 @@ discard block |
||
| 8111 | 8111 | } |
| 8112 | 8112 | } |
| 8113 | 8113 | if ($showempty) { |
| 8114 | - $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
| 8114 | + $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
|
| 8115 | 8115 | } |
| 8116 | 8116 | |
| 8117 | 8117 | $i = 0; |
@@ -8169,13 +8169,13 @@ discard block |
||
| 8169 | 8169 | $outlabel = $objp->label; |
| 8170 | 8170 | $outtype = $objp->fk_product_type; |
| 8171 | 8171 | |
| 8172 | - $opt = '<option value="' . $objp->rowid . '"'; |
|
| 8172 | + $opt = '<option value="'.$objp->rowid.'"'; |
|
| 8173 | 8173 | $opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
| 8174 | 8174 | $opt .= '>'; |
| 8175 | 8175 | $opt .= $objp->ref; |
| 8176 | 8176 | $objRef = $objp->ref; |
| 8177 | 8177 | if (!empty($filterkey) && $filterkey != '') { |
| 8178 | - $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
| 8178 | + $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
|
| 8179 | 8179 | } |
| 8180 | 8180 | |
| 8181 | 8181 | $opt .= "</option>\n"; |
@@ -8217,7 +8217,7 @@ discard block |
||
| 8217 | 8217 | $placeholder = ''; |
| 8218 | 8218 | |
| 8219 | 8219 | if ($selected && empty($selected_input_value)) { |
| 8220 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 8220 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 8221 | 8221 | $adherenttmpselect = new Adherent($this->db); |
| 8222 | 8222 | $adherenttmpselect->fetch($selected); |
| 8223 | 8223 | $selected_input_value = $adherenttmpselect->ref; |
@@ -8226,17 +8226,17 @@ discard block |
||
| 8226 | 8226 | |
| 8227 | 8227 | $urloption = ''; |
| 8228 | 8228 | |
| 8229 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
| 8229 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
| 8230 | 8230 | |
| 8231 | 8231 | if (empty($hidelabel)) { |
| 8232 | - $out .= $langs->trans("RefOrLabel") . ' : '; |
|
| 8232 | + $out .= $langs->trans("RefOrLabel").' : '; |
|
| 8233 | 8233 | } elseif ($hidelabel > 1) { |
| 8234 | - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
| 8234 | + $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
|
| 8235 | 8235 | if ($hidelabel == 2) { |
| 8236 | 8236 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 8237 | 8237 | } |
| 8238 | 8238 | } |
| 8239 | - $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
| 8239 | + $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
|
| 8240 | 8240 | if ($hidelabel == 3) { |
| 8241 | 8241 | $out .= img_picto($langs->trans("Search"), 'search'); |
| 8242 | 8242 | } |
@@ -8281,8 +8281,8 @@ discard block |
||
| 8281 | 8281 | |
| 8282 | 8282 | $sql = "SELECT "; |
| 8283 | 8283 | $sql .= $selectFields; |
| 8284 | - $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
|
| 8285 | - $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
| 8284 | + $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
| 8285 | + $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
|
| 8286 | 8286 | |
| 8287 | 8287 | // Add criteria on ref/label |
| 8288 | 8288 | if ($filterkey != '') { |
@@ -8298,8 +8298,8 @@ discard block |
||
| 8298 | 8298 | if ($i > 0) { |
| 8299 | 8299 | $sql .= " AND "; |
| 8300 | 8300 | } |
| 8301 | - $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
| 8302 | - $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
| 8301 | + $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
| 8302 | + $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
|
| 8303 | 8303 | $i++; |
| 8304 | 8304 | } |
| 8305 | 8305 | if (count($search_crit) > 1) { |
@@ -8308,27 +8308,27 @@ discard block |
||
| 8308 | 8308 | $sql .= ')'; |
| 8309 | 8309 | } |
| 8310 | 8310 | if ($status != -1) { |
| 8311 | - $sql .= ' AND statut = ' . ((int) $status); |
|
| 8311 | + $sql .= ' AND statut = '.((int) $status); |
|
| 8312 | 8312 | } |
| 8313 | 8313 | $sql .= $this->db->plimit($limit, 0); |
| 8314 | 8314 | |
| 8315 | 8315 | // Build output string |
| 8316 | - dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
| 8316 | + dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
|
| 8317 | 8317 | $result = $this->db->query($sql); |
| 8318 | 8318 | if ($result) { |
| 8319 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 8320 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
| 8319 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 8320 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
|
| 8321 | 8321 | |
| 8322 | 8322 | $num = $this->db->num_rows($result); |
| 8323 | 8323 | |
| 8324 | 8324 | $events = array(); |
| 8325 | 8325 | |
| 8326 | 8326 | if (!$forcecombo) { |
| 8327 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 8327 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 8328 | 8328 | $out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
| 8329 | 8329 | } |
| 8330 | 8330 | |
| 8331 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 8331 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 8332 | 8332 | |
| 8333 | 8333 | $textifempty = ''; |
| 8334 | 8334 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
@@ -8345,7 +8345,7 @@ discard block |
||
| 8345 | 8345 | } |
| 8346 | 8346 | } |
| 8347 | 8347 | if ($showempty) { |
| 8348 | - $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
| 8348 | + $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
|
| 8349 | 8349 | } |
| 8350 | 8350 | |
| 8351 | 8351 | $i = 0; |
@@ -8401,11 +8401,11 @@ discard block |
||
| 8401 | 8401 | $outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
| 8402 | 8402 | $outtype = $objp->fk_adherent_type; |
| 8403 | 8403 | |
| 8404 | - $opt = '<option value="' . $objp->rowid . '"'; |
|
| 8404 | + $opt = '<option value="'.$objp->rowid.'"'; |
|
| 8405 | 8405 | $opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
| 8406 | 8406 | $opt .= '>'; |
| 8407 | 8407 | if (!empty($filterkey) && $filterkey != '') { |
| 8408 | - $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
| 8408 | + $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
|
| 8409 | 8409 | } |
| 8410 | 8410 | $opt .= $outlabel; |
| 8411 | 8411 | $opt .= "</option>\n"; |
@@ -8460,8 +8460,8 @@ discard block |
||
| 8460 | 8460 | $objecttmp = null; |
| 8461 | 8461 | $InfoFieldList = array(); |
| 8462 | 8462 | $classname = ''; |
| 8463 | - $filter = ''; // Ensure filter has value (for static analysis) |
|
| 8464 | - $sortfield = ''; // Ensure filter has value (for static analysis) |
|
| 8463 | + $filter = ''; // Ensure filter has value (for static analysis) |
|
| 8464 | + $sortfield = ''; // Ensure filter has value (for static analysis) |
|
| 8465 | 8465 | |
| 8466 | 8466 | if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
| 8467 | 8467 | // Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
@@ -8505,9 +8505,9 @@ discard block |
||
| 8505 | 8505 | $vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
| 8506 | 8506 | $reg = array(); |
| 8507 | 8507 | if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
| 8508 | - $InfoFieldList[4] = $reg[1]; // take the sort field |
|
| 8508 | + $InfoFieldList[4] = $reg[1]; // take the sort field |
|
| 8509 | 8509 | } |
| 8510 | - $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
| 8510 | + $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
| 8511 | 8511 | |
| 8512 | 8512 | $classname = $InfoFieldList[0]; |
| 8513 | 8513 | $classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; |
@@ -8538,8 +8538,8 @@ discard block |
||
| 8538 | 8538 | ); |
| 8539 | 8539 | |
| 8540 | 8540 | if (!is_object($objecttmp)) { |
| 8541 | - dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
| 8542 | - return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
| 8541 | + dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
| 8542 | + return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
| 8543 | 8543 | } |
| 8544 | 8544 | '@phan-var-force CommonObject $objecttmp'; |
| 8545 | 8545 | /** @var CommonObject $objecttmp */ |
@@ -8551,9 +8551,9 @@ discard block |
||
| 8551 | 8551 | if ($prefixforautocompletemode == 'product') { |
| 8552 | 8552 | $prefixforautocompletemode = 'produit'; |
| 8553 | 8553 | } |
| 8554 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
| 8554 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
| 8555 | 8555 | |
| 8556 | - dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
| 8556 | + dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
|
| 8557 | 8557 | |
| 8558 | 8558 | // Generate the combo HTML component |
| 8559 | 8559 | $out = ''; |
@@ -8582,13 +8582,13 @@ discard block |
||
| 8582 | 8582 | } |
| 8583 | 8583 | |
| 8584 | 8584 | // Set url and param to call to get json of the search results |
| 8585 | - $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
|
| 8586 | - $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
| 8585 | + $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
| 8586 | + $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
|
| 8587 | 8587 | |
| 8588 | 8588 | // Activate the auto complete using ajax call. |
| 8589 | 8589 | $out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0); |
| 8590 | 8590 | $out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
| 8591 | - $out .= '<input type="text" class="' . $morecss . '"' . ($disabled ? ' disabled="disabled"' : '') . ' name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' />'; |
|
| 8591 | + $out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' />'; |
|
| 8592 | 8592 | } else { |
| 8593 | 8593 | // Immediate load of table record. |
| 8594 | 8594 | $out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
@@ -8628,16 +8628,16 @@ discard block |
||
| 8628 | 8628 | if ($prefixforautocompletemode == 'societe') { |
| 8629 | 8629 | $prefixforautocompletemode = 'company'; |
| 8630 | 8630 | } |
| 8631 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
| 8631 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
| 8632 | 8632 | |
| 8633 | 8633 | if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
| 8634 | 8634 | $tmpfieldstoshow = ''; |
| 8635 | 8635 | foreach ($objecttmp->fields as $key => $val) { |
| 8636 | - if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
| 8636 | + if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
| 8637 | 8637 | continue; |
| 8638 | 8638 | } |
| 8639 | 8639 | if (!empty($val['showoncombobox'])) { |
| 8640 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
| 8640 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
|
| 8641 | 8641 | } |
| 8642 | 8642 | } |
| 8643 | 8643 | if ($tmpfieldstoshow) { |
@@ -8674,25 +8674,25 @@ discard block |
||
| 8674 | 8674 | $num = 0; |
| 8675 | 8675 | |
| 8676 | 8676 | // Search data |
| 8677 | - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t"; |
|
| 8677 | + $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)." as t"; |
|
| 8678 | 8678 | if (!empty($objecttmp->isextrafieldmanaged)) { |
| 8679 | - $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object"; |
|
| 8679 | + $sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)."_extrafields as e ON t.rowid = e.fk_object"; |
|
| 8680 | 8680 | } |
| 8681 | 8681 | if (!empty($objecttmp->parent_element)) { |
| 8682 | 8682 | $parent_properties = getElementProperties($objecttmp->parent_element); |
| 8683 | - $sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute; |
|
| 8683 | + $sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($parent_properties['table_element'])." as o ON o.rowid = t.".$objecttmp->fk_parent_attribute; |
|
| 8684 | 8684 | } |
| 8685 | 8685 | if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) { |
| 8686 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product"; |
|
| 8686 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = t.fk_product"; |
|
| 8687 | 8687 | } |
| 8688 | 8688 | if (isset($objecttmp->ismultientitymanaged)) { |
| 8689 | 8689 | if (!is_numeric($objecttmp->ismultientitymanaged)) { |
| 8690 | 8690 | $tmparray = explode('@', $objecttmp->ismultientitymanaged); |
| 8691 | - $sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]); |
|
| 8691 | + $sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($tmparray[1])." as parenttable ON parenttable.rowid = t.".$this->db->sanitize($tmparray[0]); |
|
| 8692 | 8692 | } |
| 8693 | 8693 | if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
| 8694 | 8694 | if (!$user->hasRight('societe', 'client', 'voir')) { |
| 8695 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
| 8695 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
|
| 8696 | 8696 | } |
| 8697 | 8697 | } |
| 8698 | 8698 | } |
@@ -8712,27 +8712,27 @@ discard block |
||
| 8712 | 8712 | $sql .= " WHERE 1=1"; |
| 8713 | 8713 | if (isset($objecttmp->ismultientitymanaged)) { |
| 8714 | 8714 | if ($objecttmp->ismultientitymanaged == 1) { |
| 8715 | - $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
| 8715 | + $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
|
| 8716 | 8716 | } |
| 8717 | 8717 | if (!is_numeric($objecttmp->ismultientitymanaged)) { |
| 8718 | - $sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]); |
|
| 8718 | + $sql .= " AND parenttable.entity = t.".$this->db->sanitize($tmparray[0]); |
|
| 8719 | 8719 | } |
| 8720 | 8720 | if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
| 8721 | 8721 | if ($objecttmp->element == 'societe') { |
| 8722 | - $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
| 8722 | + $sql .= " AND t.rowid = ".((int) $user->socid); |
|
| 8723 | 8723 | } else { |
| 8724 | - $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
| 8724 | + $sql .= " AND t.fk_soc = ".((int) $user->socid); |
|
| 8725 | 8725 | } |
| 8726 | 8726 | } |
| 8727 | 8727 | if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
| 8728 | 8728 | if (!$user->hasRight('societe', 'client', 'voir')) { |
| 8729 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
| 8729 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
|
| 8730 | 8730 | } |
| 8731 | 8731 | } |
| 8732 | 8732 | } |
| 8733 | 8733 | $splittedfieldstoshow = explode(',', $fieldstoshow); |
| 8734 | 8734 | foreach ($splittedfieldstoshow as &$field2) { |
| 8735 | - if (is_numeric($pos=strpos($field2, ' '))) { |
|
| 8735 | + if (is_numeric($pos = strpos($field2, ' '))) { |
|
| 8736 | 8736 | $field2 = substr($field2, 0, $pos); |
| 8737 | 8737 | } |
| 8738 | 8738 | } |
@@ -8744,7 +8744,7 @@ discard block |
||
| 8744 | 8744 | $errormessage = ''; |
| 8745 | 8745 | $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
| 8746 | 8746 | if ($errormessage) { |
| 8747 | - return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
| 8747 | + return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
|
| 8748 | 8748 | } |
| 8749 | 8749 | } |
| 8750 | 8750 | } |
@@ -8756,7 +8756,7 @@ discard block |
||
| 8756 | 8756 | $resql = $this->db->query($sql); |
| 8757 | 8757 | if ($resql) { |
| 8758 | 8758 | // Construct $out and $outarray |
| 8759 | - $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
| 8759 | + $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
|
| 8760 | 8760 | |
| 8761 | 8761 | // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
| 8762 | 8762 | $textifempty = ' '; |
@@ -8770,7 +8770,7 @@ discard block |
||
| 8770 | 8770 | } |
| 8771 | 8771 | } |
| 8772 | 8772 | if ($showempty) { |
| 8773 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
| 8773 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
|
| 8774 | 8774 | } |
| 8775 | 8775 | |
| 8776 | 8776 | $num = $this->db->num_rows($resql); |
@@ -8793,9 +8793,9 @@ discard block |
||
| 8793 | 8793 | } |
| 8794 | 8794 | if (empty($outputmode)) { |
| 8795 | 8795 | if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
| 8796 | - $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
| 8796 | + $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
|
| 8797 | 8797 | } else { |
| 8798 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
| 8798 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
|
| 8799 | 8799 | } |
| 8800 | 8800 | } else { |
| 8801 | 8801 | array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
@@ -8808,10 +8808,10 @@ discard block |
||
| 8808 | 8808 | } |
| 8809 | 8809 | } |
| 8810 | 8810 | |
| 8811 | - $out .= '</select>' . "\n"; |
|
| 8811 | + $out .= '</select>'."\n"; |
|
| 8812 | 8812 | |
| 8813 | 8813 | if (!$forcecombo) { |
| 8814 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 8814 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 8815 | 8815 | $out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
| 8816 | 8816 | } |
| 8817 | 8817 | } else { |
@@ -8875,8 +8875,8 @@ discard block |
||
| 8875 | 8875 | } |
| 8876 | 8876 | } |
| 8877 | 8877 | $idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
| 8878 | - $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
|
| 8879 | - $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
| 8878 | + $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
| 8879 | + $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
|
| 8880 | 8880 | $out .= '>'."\n"; |
| 8881 | 8881 | |
| 8882 | 8882 | if ($show_empty) { |
@@ -8887,7 +8887,7 @@ discard block |
||
| 8887 | 8887 | if (!is_numeric($show_empty)) { |
| 8888 | 8888 | $textforempty = $show_empty; |
| 8889 | 8889 | } |
| 8890 | - $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
| 8890 | + $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
|
| 8891 | 8891 | } |
| 8892 | 8892 | if (is_array($array)) { |
| 8893 | 8893 | // Translate |
@@ -8912,7 +8912,7 @@ discard block |
||
| 8912 | 8912 | $value = $tmpvalue['label']; |
| 8913 | 8913 | //$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
| 8914 | 8914 | $disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
| 8915 | - $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
| 8915 | + $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
|
| 8916 | 8916 | } else { |
| 8917 | 8917 | $value = $tmpvalue; |
| 8918 | 8918 | //$valuehtml = $tmpvalue; |
@@ -8928,9 +8928,9 @@ discard block |
||
| 8928 | 8928 | } |
| 8929 | 8929 | if ($key_in_label) { |
| 8930 | 8930 | if (empty($nohtmlescape)) { |
| 8931 | - $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
| 8931 | + $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
| 8932 | 8932 | } else { |
| 8933 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
| 8933 | + $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
| 8934 | 8934 | } |
| 8935 | 8935 | } else { |
| 8936 | 8936 | if (empty($nohtmlescape)) { |
@@ -8942,8 +8942,8 @@ discard block |
||
| 8942 | 8942 | $selectOptionValue = ' '; |
| 8943 | 8943 | } |
| 8944 | 8944 | } |
| 8945 | - $out .= '<option value="' . $key . '"'; |
|
| 8946 | - $out .= $style . $disabled; |
|
| 8945 | + $out .= '<option value="'.$key.'"'; |
|
| 8946 | + $out .= $style.$disabled; |
|
| 8947 | 8947 | if (is_array($id)) { |
| 8948 | 8948 | if (in_array($key, $id) && !$disabled) { |
| 8949 | 8949 | $out .= ' selected'; // To preselect a value |
@@ -8955,7 +8955,7 @@ discard block |
||
| 8955 | 8955 | } |
| 8956 | 8956 | } |
| 8957 | 8957 | if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
| 8958 | - $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
| 8958 | + $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
|
| 8959 | 8959 | } |
| 8960 | 8960 | |
| 8961 | 8961 | if (is_array($tmpvalue)) { |
@@ -8978,7 +8978,7 @@ discard block |
||
| 8978 | 8978 | // Add code for jquery to use multiselect |
| 8979 | 8979 | if ($addjscombo && $jsbeautify) { |
| 8980 | 8980 | // Enhance with select2 |
| 8981 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 8981 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 8982 | 8982 | $out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
| 8983 | 8983 | } |
| 8984 | 8984 | |
@@ -9006,28 +9006,28 @@ discard block |
||
| 9006 | 9006 | public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
| 9007 | 9007 | { |
| 9008 | 9008 | global $conf, $langs; |
| 9009 | - global $delayedhtmlcontent; // Will be used later outside of this function |
|
| 9009 | + global $delayedhtmlcontent; // Will be used later outside of this function |
|
| 9010 | 9010 | |
| 9011 | 9011 | // TODO Use an internal dolibarr component instead of select2 |
| 9012 | 9012 | if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
| 9013 | 9013 | return ''; |
| 9014 | 9014 | } |
| 9015 | 9015 | |
| 9016 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
| 9016 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
|
| 9017 | 9017 | |
| 9018 | 9018 | $outdelayed = ''; |
| 9019 | 9019 | if (!empty($conf->use_javascript_ajax)) { |
| 9020 | 9020 | $tmpplugin = 'select2'; |
| 9021 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
|
| 9022 | - <script nonce="' . getNonce() . '"> |
|
| 9021 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
| 9022 | + <script nonce="' . getNonce().'"> |
|
| 9023 | 9023 | $(document).ready(function () { |
| 9024 | 9024 | |
| 9025 | - ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
| 9025 | + ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
|
| 9026 | 9026 | |
| 9027 | - $(".' . $htmlname . '").select2({ |
|
| 9027 | + $(".' . $htmlname.'").select2({ |
|
| 9028 | 9028 | ajax: { |
| 9029 | 9029 | dir: "ltr", |
| 9030 | - url: "' . $url . '", |
|
| 9030 | + url: "' . $url.'", |
|
| 9031 | 9031 | dataType: \'json\', |
| 9032 | 9032 | delay: 250, |
| 9033 | 9033 | data: function (params) { |
@@ -9054,9 +9054,9 @@ discard block |
||
| 9054 | 9054 | }, |
| 9055 | 9055 | language: select2arrayoflanguage, |
| 9056 | 9056 | containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */ |
| 9057 | - placeholder: "' . dol_escape_js($placeholder) . '", |
|
| 9057 | + placeholder: "' . dol_escape_js($placeholder).'", |
|
| 9058 | 9058 | escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
| 9059 | - minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
| 9059 | + minimumInputLength: ' . ((int) $minimumInputLength).', |
|
| 9060 | 9060 | formatResult: function (result, container, query, escapeMarkup) { |
| 9061 | 9061 | return escapeMarkup(result.text); |
| 9062 | 9062 | }, |
@@ -9064,10 +9064,10 @@ discard block |
||
| 9064 | 9064 | |
| 9065 | 9065 | ' . ($callurlonselect ? ' |
| 9066 | 9066 | /* Code to execute a GET when we select a value */ |
| 9067 | - $(".' . $htmlname . '").change(function() { |
|
| 9068 | - var selected = $(".' . $htmlname . '").val(); |
|
| 9067 | + $(".' . $htmlname.'").change(function() { |
|
| 9068 | + var selected = $(".' . $htmlname.'").val(); |
|
| 9069 | 9069 | console.log("We select in selectArrayAjax the entry "+selected) |
| 9070 | - $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
| 9070 | + $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
|
| 9071 | 9071 | $.each( saveRemoteData, function( key, value ) { |
| 9072 | 9072 | if (key == selected) |
| 9073 | 9073 | { |
@@ -9075,7 +9075,7 @@ discard block |
||
| 9075 | 9075 | location.assign(value.url); |
| 9076 | 9076 | } |
| 9077 | 9077 | }); |
| 9078 | - });' : '') . ' |
|
| 9078 | + });' : '').' |
|
| 9079 | 9079 | |
| 9080 | 9080 | }); |
| 9081 | 9081 | </script>'; |
@@ -9111,14 +9111,14 @@ discard block |
||
| 9111 | 9111 | public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
| 9112 | 9112 | { |
| 9113 | 9113 | global $conf, $langs; |
| 9114 | - global $delayedhtmlcontent; // Will be used later outside of this function |
|
| 9114 | + global $delayedhtmlcontent; // Will be used later outside of this function |
|
| 9115 | 9115 | |
| 9116 | 9116 | // TODO Use an internal dolibarr component instead of select2 |
| 9117 | 9117 | if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
| 9118 | 9118 | return ''; |
| 9119 | 9119 | } |
| 9120 | 9120 | |
| 9121 | - $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
| 9121 | + $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
| 9122 | 9122 | |
| 9123 | 9123 | $formattedarrayresult = array(); |
| 9124 | 9124 | |
@@ -9133,20 +9133,20 @@ discard block |
||
| 9133 | 9133 | $outdelayed = ''; |
| 9134 | 9134 | if (!empty($conf->use_javascript_ajax)) { |
| 9135 | 9135 | $tmpplugin = 'select2'; |
| 9136 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
|
| 9137 | - <script nonce="' . getNonce() . '"> |
|
| 9136 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
| 9137 | + <script nonce="' . getNonce().'"> |
|
| 9138 | 9138 | $(document).ready(function () { |
| 9139 | - var data = ' . json_encode($formattedarrayresult) . '; |
|
| 9139 | + var data = ' . json_encode($formattedarrayresult).'; |
|
| 9140 | 9140 | |
| 9141 | - ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
| 9141 | + ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
|
| 9142 | 9142 | |
| 9143 | - $(".' . $htmlname . '").select2({ |
|
| 9143 | + $(".' . $htmlname.'").select2({ |
|
| 9144 | 9144 | data: data, |
| 9145 | 9145 | language: select2arrayoflanguage, |
| 9146 | 9146 | containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */ |
| 9147 | - placeholder: "' . dol_escape_js($placeholder) . '", |
|
| 9147 | + placeholder: "' . dol_escape_js($placeholder).'", |
|
| 9148 | 9148 | escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
| 9149 | - minimumInputLength: ' . $minimumInputLength . ', |
|
| 9149 | + minimumInputLength: ' . $minimumInputLength.', |
|
| 9150 | 9150 | formatResult: function (result, container, query, escapeMarkup) { |
| 9151 | 9151 | return escapeMarkup(result.text); |
| 9152 | 9152 | }, |
@@ -9185,11 +9185,11 @@ discard block |
||
| 9185 | 9185 | |
| 9186 | 9186 | ' . ($callurlonselect ? ' |
| 9187 | 9187 | /* Code to execute a GET when we select a value */ |
| 9188 | - $(".' . $htmlname . '").change(function() { |
|
| 9189 | - var selected = $(".' . $htmlname . '").val(); |
|
| 9188 | + $(".' . $htmlname.'").change(function() { |
|
| 9189 | + var selected = $(".' . $htmlname.'").val(); |
|
| 9190 | 9190 | console.log("We select "+selected) |
| 9191 | 9191 | |
| 9192 | - $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
| 9192 | + $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
|
| 9193 | 9193 | $.each( saveRemoteData, function( key, value ) { |
| 9194 | 9194 | if (key == selected) |
| 9195 | 9195 | { |
@@ -9197,7 +9197,7 @@ discard block |
||
| 9197 | 9197 | location.assign(value.url); |
| 9198 | 9198 | } |
| 9199 | 9199 | }); |
| 9200 | - });' : '') . ' |
|
| 9200 | + });' : '').' |
|
| 9201 | 9201 | |
| 9202 | 9202 | }); |
| 9203 | 9203 | </script>'; |
@@ -9245,7 +9245,7 @@ discard block |
||
| 9245 | 9245 | $useenhancedmultiselect = 0; |
| 9246 | 9246 | if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
| 9247 | 9247 | if ($addjscombo) { |
| 9248 | - $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
| 9248 | + $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
| 9249 | 9249 | } |
| 9250 | 9250 | } |
| 9251 | 9251 | |
@@ -9254,7 +9254,7 @@ discard block |
||
| 9254 | 9254 | // submitted to nothing. |
| 9255 | 9255 | $out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
| 9256 | 9256 | // Output select component |
| 9257 | - $out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', (string) $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; |
|
| 9257 | + $out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', (string) $width) ? $width : $width.'px').'"' : '').'>'."\n"; |
|
| 9258 | 9258 | if (is_array($array) && !empty($array)) { |
| 9259 | 9259 | if ($value_as_key) { |
| 9260 | 9260 | $array = array_combine($array, $array); |
@@ -9275,33 +9275,33 @@ discard block |
||
| 9275 | 9275 | $tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; |
| 9276 | 9276 | } |
| 9277 | 9277 | $newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
| 9278 | - $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
| 9278 | + $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
|
| 9279 | 9279 | |
| 9280 | - $out .= '<option value="' . $tmpkey . '"'; |
|
| 9280 | + $out .= '<option value="'.$tmpkey.'"'; |
|
| 9281 | 9281 | if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
| 9282 | 9282 | $out .= ' selected'; |
| 9283 | 9283 | } |
| 9284 | 9284 | if (!empty($tmplabelhtml)) { |
| 9285 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
| 9285 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
|
| 9286 | 9286 | } else { |
| 9287 | - $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
|
| 9288 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
| 9287 | + $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
| 9288 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
|
| 9289 | 9289 | } |
| 9290 | 9290 | $out .= '>'; |
| 9291 | 9291 | $out .= dol_htmlentitiesbr($newval); |
| 9292 | - $out .= '</option>' . "\n"; |
|
| 9292 | + $out .= '</option>'."\n"; |
|
| 9293 | 9293 | } |
| 9294 | 9294 | } |
| 9295 | 9295 | } |
| 9296 | - $out .= '</select>' . "\n"; |
|
| 9296 | + $out .= '</select>'."\n"; |
|
| 9297 | 9297 | |
| 9298 | 9298 | // Add code for jquery to use multiselect |
| 9299 | 9299 | if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
| 9300 | - $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
|
| 9301 | - $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
| 9300 | + $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
| 9301 | + $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
|
| 9302 | 9302 | if ($addjscombo == 1) { |
| 9303 | 9303 | $tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
| 9304 | - $out .= 'function formatResult(record, container) {' . "\n"; |
|
| 9304 | + $out .= 'function formatResult(record, container) {'."\n"; |
|
| 9305 | 9305 | // If property data-html set, we decode html entities and use this. |
| 9306 | 9306 | // Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
| 9307 | 9307 | $out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
@@ -9309,26 +9309,26 @@ discard block |
||
| 9309 | 9309 | $out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
| 9310 | 9310 | $out .= ' }'."\n"; |
| 9311 | 9311 | $out .= ' return record.text;'; |
| 9312 | - $out .= '}' . "\n"; |
|
| 9313 | - $out .= 'function formatSelection(record) {' . "\n"; |
|
| 9312 | + $out .= '}'."\n"; |
|
| 9313 | + $out .= 'function formatSelection(record) {'."\n"; |
|
| 9314 | 9314 | if ($elemtype == 'category') { |
| 9315 | - $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
| 9315 | + $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
| 9316 | 9316 | } else { |
| 9317 | 9317 | $out .= 'return record.text;'; |
| 9318 | 9318 | } |
| 9319 | - $out .= '}' . "\n"; |
|
| 9319 | + $out .= '}'."\n"; |
|
| 9320 | 9320 | $out .= '$(document).ready(function () { |
| 9321 | - $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
| 9321 | + $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
|
| 9322 | 9322 | if ($placeholder) { |
| 9323 | 9323 | $out .= ' |
| 9324 | 9324 | placeholder: { |
| 9325 | 9325 | id: \'-1\', |
| 9326 | - text: \'' . dol_escape_js($placeholder) . '\' |
|
| 9326 | + text: \'' . dol_escape_js($placeholder).'\' |
|
| 9327 | 9327 | },'; |
| 9328 | 9328 | } |
| 9329 | 9329 | $out .= ' dir: \'ltr\', |
| 9330 | 9330 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
| 9331 | - dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
| 9331 | + dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
| 9332 | 9332 | // Specify format function for dropdown item |
| 9333 | 9333 | formatResult: formatResult, |
| 9334 | 9334 | templateResult: formatResult, /* For 4.0 */ |
@@ -9340,21 +9340,21 @@ discard block |
||
| 9340 | 9340 | |
| 9341 | 9341 | /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
| 9342 | 9342 | the size only if component is not hidden by default on load */ |
| 9343 | - $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
| 9343 | + $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
|
| 9344 | 9344 | });' . "\n"; |
| 9345 | 9345 | } elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
| 9346 | 9346 | // Add other js lib |
| 9347 | 9347 | // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
| 9348 | 9348 | // ... |
| 9349 | - $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
| 9349 | + $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
|
| 9350 | 9350 | $out .= '$(document).ready(function () { |
| 9351 | - $(\'#' . $htmlname . '\').multiSelect({ |
|
| 9351 | + $(\'#' . $htmlname.'\').multiSelect({ |
|
| 9352 | 9352 | containerHTML: \'<div class="multi-select-container">\', |
| 9353 | 9353 | menuHTML: \'<div class="multi-select-menu">\', |
| 9354 | - buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
| 9354 | + buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
|
| 9355 | 9355 | menuItemHTML: \'<label class="multi-select-menuitem">\', |
| 9356 | 9356 | activeClass: \'multi-select-container--open\', |
| 9357 | - noneText: \'' . $placeholder . '\' |
|
| 9357 | + noneText: \'' . $placeholder.'\' |
|
| 9358 | 9358 | }); |
| 9359 | 9359 | })'; |
| 9360 | 9360 | } |
@@ -9387,7 +9387,7 @@ discard block |
||
| 9387 | 9387 | return ''; |
| 9388 | 9388 | } |
| 9389 | 9389 | |
| 9390 | - $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
| 9390 | + $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
|
| 9391 | 9391 | |
| 9392 | 9392 | if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
| 9393 | 9393 | $tmparray = explode(',', $user->conf->$tmpvar); |
@@ -9430,19 +9430,19 @@ discard block |
||
| 9430 | 9430 | } |
| 9431 | 9431 | |
| 9432 | 9432 | // Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
| 9433 | - $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; |
|
| 9434 | - $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
| 9433 | + $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; |
|
| 9434 | + $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
|
| 9435 | 9435 | } |
| 9436 | 9436 | } |
| 9437 | 9437 | |
| 9438 | - $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
| 9438 | + $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
|
| 9439 | 9439 | |
| 9440 | 9440 | <dl class="dropdown"> |
| 9441 | 9441 | <dt> |
| 9442 | - <a href="#' . $htmlname . '"> |
|
| 9443 | - ' . img_picto('', 'list') . ' |
|
| 9442 | + <a href="#' . $htmlname.'"> |
|
| 9443 | + ' . img_picto('', 'list').' |
|
| 9444 | 9444 | </a> |
| 9445 | - <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
| 9445 | + <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
|
| 9446 | 9446 | </dt> |
| 9447 | 9447 | <dd class="dropdowndd"> |
| 9448 | 9448 | <div class="multiselectcheckbox'.$htmlname.'"> |
@@ -9454,19 +9454,19 @@ discard block |
||
| 9454 | 9454 | </dd> |
| 9455 | 9455 | </dl> |
| 9456 | 9456 | |
| 9457 | - <script nonce="' . getNonce() . '" type="text/javascript"> |
|
| 9457 | + <script nonce="' . getNonce().'" type="text/javascript"> |
|
| 9458 | 9458 | jQuery(document).ready(function () { |
| 9459 | - $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
| 9459 | + $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
|
| 9460 | 9460 | console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
| 9461 | 9461 | |
| 9462 | 9462 | $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
| 9463 | 9463 | |
| 9464 | 9464 | var title = $(this).val() + ","; |
| 9465 | 9465 | if ($(this).is(\':checked\')) { |
| 9466 | - $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
| 9466 | + $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
|
| 9467 | 9467 | } |
| 9468 | 9468 | else { |
| 9469 | - $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
| 9469 | + $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
|
| 9470 | 9470 | } |
| 9471 | 9471 | // Now, we submit page |
| 9472 | 9472 | //$(this).parents(\'form:first\').submit(); |
@@ -9497,7 +9497,7 @@ discard block |
||
| 9497 | 9497 | */ |
| 9498 | 9498 | public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
| 9499 | 9499 | { |
| 9500 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 9500 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 9501 | 9501 | |
| 9502 | 9502 | $cat = new Categorie($this->db); |
| 9503 | 9503 | $categories = $cat->containing($id, $type); |
@@ -9507,13 +9507,13 @@ discard block |
||
| 9507 | 9507 | foreach ($categories as $c) { |
| 9508 | 9508 | $ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 9509 | 9509 | foreach ($ways as $way) { |
| 9510 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
| 9510 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
|
| 9511 | 9511 | } |
| 9512 | 9512 | } |
| 9513 | 9513 | if (empty($toprint)) { |
| 9514 | 9514 | return ''; |
| 9515 | 9515 | } else { |
| 9516 | - return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 9516 | + return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 9517 | 9517 | } |
| 9518 | 9518 | } |
| 9519 | 9519 | |
@@ -9562,15 +9562,15 @@ discard block |
||
| 9562 | 9562 | |
| 9563 | 9563 | |
| 9564 | 9564 | print '<div class="div-table-responsive-no-min">'; |
| 9565 | - print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
| 9565 | + print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
|
| 9566 | 9566 | |
| 9567 | 9567 | print '<tr class="liste_titre">'; |
| 9568 | - print '<td>' . $langs->trans("Type") . '</td>'; |
|
| 9569 | - print '<td>' . $langs->trans("Ref") . '</td>'; |
|
| 9568 | + print '<td>'.$langs->trans("Type").'</td>'; |
|
| 9569 | + print '<td>'.$langs->trans("Ref").'</td>'; |
|
| 9570 | 9570 | print '<td class="center"></td>'; |
| 9571 | - print '<td class="center">' . $langs->trans("Date") . '</td>'; |
|
| 9572 | - print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
|
| 9573 | - print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
| 9571 | + print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
| 9572 | + print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
| 9573 | + print '<td class="right">'.$langs->trans("Status").'</td>'; |
|
| 9574 | 9574 | print '<td></td>'; |
| 9575 | 9575 | print '</tr>'; |
| 9576 | 9576 | |
@@ -9589,13 +9589,13 @@ discard block |
||
| 9589 | 9589 | if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
| 9590 | 9590 | $element = $regs[1]; |
| 9591 | 9591 | $subelement = $regs[2]; |
| 9592 | - $tplpath = $element . '/' . $subelement; |
|
| 9592 | + $tplpath = $element.'/'.$subelement; |
|
| 9593 | 9593 | } |
| 9594 | 9594 | $tplname = 'linkedobjectblock'; |
| 9595 | 9595 | |
| 9596 | 9596 | // To work with non standard path |
| 9597 | 9597 | if ($objecttype == 'facture') { |
| 9598 | - $tplpath = 'compta/' . $element; |
|
| 9598 | + $tplpath = 'compta/'.$element; |
|
| 9599 | 9599 | if (!isModEnabled('invoice')) { |
| 9600 | 9600 | continue; // Do not show if module disabled |
| 9601 | 9601 | } |
@@ -9606,7 +9606,7 @@ discard block |
||
| 9606 | 9606 | continue; // Do not show if module disabled |
| 9607 | 9607 | } |
| 9608 | 9608 | } elseif ($objecttype == 'propal') { |
| 9609 | - $tplpath = 'comm/' . $element; |
|
| 9609 | + $tplpath = 'comm/'.$element; |
|
| 9610 | 9610 | if (!isModEnabled('propal')) { |
| 9611 | 9611 | continue; // Do not show if module disabled |
| 9612 | 9612 | } |
@@ -9659,7 +9659,7 @@ discard block |
||
| 9659 | 9659 | $linkedObjectBlock = $objects; |
| 9660 | 9660 | |
| 9661 | 9661 | // Output template part (modules that overwrite templates must declare this into descriptor) |
| 9662 | - $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
| 9662 | + $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
|
| 9663 | 9663 | foreach ($dirtpls as $reldir) { |
| 9664 | 9664 | $reldir = rtrim($reldir, '/'); |
| 9665 | 9665 | if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
@@ -9667,7 +9667,7 @@ discard block |
||
| 9667 | 9667 | $noMoreLinkedObjectBlockAfter = 1; |
| 9668 | 9668 | } |
| 9669 | 9669 | |
| 9670 | - $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
| 9670 | + $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
|
| 9671 | 9671 | if ($res) { |
| 9672 | 9672 | $nboftypesoutput++; |
| 9673 | 9673 | break; |
@@ -9676,7 +9676,7 @@ discard block |
||
| 9676 | 9676 | } |
| 9677 | 9677 | |
| 9678 | 9678 | if (!$nboftypesoutput) { |
| 9679 | - print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
| 9679 | + print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
|
| 9680 | 9680 | } |
| 9681 | 9681 | |
| 9682 | 9682 | print '</table>'; |
@@ -9724,14 +9724,14 @@ discard block |
||
| 9724 | 9724 | if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
| 9725 | 9725 | $listofidcompanytoscan = (int) $object->thirdparty->id; |
| 9726 | 9726 | if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
| 9727 | - $listofidcompanytoscan .= ',' . (int) $object->thirdparty->parent; |
|
| 9727 | + $listofidcompanytoscan .= ','.(int) $object->thirdparty->parent; |
|
| 9728 | 9728 | } |
| 9729 | 9729 | if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
| 9730 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 9730 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 9731 | 9731 | $tmpproject = new Project($this->db); |
| 9732 | 9732 | $tmpproject->fetch($object->fk_project); |
| 9733 | 9733 | if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
| 9734 | - $listofidcompanytoscan .= ',' . (int) $tmpproject->socid; |
|
| 9734 | + $listofidcompanytoscan .= ','.(int) $tmpproject->socid; |
|
| 9735 | 9735 | } |
| 9736 | 9736 | unset($tmpproject); |
| 9737 | 9737 | } |
@@ -9741,75 +9741,75 @@ discard block |
||
| 9741 | 9741 | 'enabled' => isModEnabled('propal'), |
| 9742 | 9742 | 'perms' => 1, |
| 9743 | 9743 | 'label' => 'LinkToProposal', |
| 9744 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''), |
|
| 9744 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''), |
|
| 9745 | 9745 | ), |
| 9746 | 9746 | 'shipping' => array( |
| 9747 | 9747 | 'enabled' => isModEnabled('shipping'), |
| 9748 | 9748 | 'perms' => 1, |
| 9749 | 9749 | 'label' => 'LinkToExpedition', |
| 9750 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : ''), |
|
| 9750 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('shipping').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : ''), |
|
| 9751 | 9751 | ), |
| 9752 | 9752 | 'order' => array( |
| 9753 | 9753 | 'enabled' => isModEnabled('order'), |
| 9754 | 9754 | 'perms' => 1, |
| 9755 | 9755 | 'label' => 'LinkToOrder', |
| 9756 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : ''), |
|
| 9756 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : ''), |
|
| 9757 | 9757 | 'linkname' => 'commande', |
| 9758 | 9758 | ), |
| 9759 | 9759 | 'invoice' => array( |
| 9760 | 9760 | 'enabled' => isModEnabled('invoice'), |
| 9761 | 9761 | 'perms' => 1, |
| 9762 | 9762 | 'label' => 'LinkToInvoice', |
| 9763 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''), |
|
| 9763 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''), |
|
| 9764 | 9764 | 'linkname' => 'facture', |
| 9765 | 9765 | ), |
| 9766 | 9766 | 'invoice_template' => array( |
| 9767 | 9767 | 'enabled' => isModEnabled('invoice'), |
| 9768 | 9768 | 'perms' => 1, |
| 9769 | 9769 | 'label' => 'LinkToTemplateInvoice', |
| 9770 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''), |
|
| 9770 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''), |
|
| 9771 | 9771 | ), |
| 9772 | 9772 | 'contrat' => array( |
| 9773 | 9773 | 'enabled' => isModEnabled('contract'), |
| 9774 | 9774 | 'perms' => 1, |
| 9775 | 9775 | 'label' => 'LinkToContract', |
| 9776 | 9776 | 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht |
| 9777 | - FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "contrat as t, " . $this->db->prefix() . "contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('contract') . ') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier', |
|
| 9777 | + FROM " . $this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier', |
|
| 9778 | 9778 | ), |
| 9779 | 9779 | 'fichinter' => array( |
| 9780 | 9780 | 'enabled' => isModEnabled('intervention'), |
| 9781 | 9781 | 'perms' => 1, |
| 9782 | 9782 | 'label' => 'LinkToIntervention', |
| 9783 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('intervention') . ')', |
|
| 9783 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')', |
|
| 9784 | 9784 | ), |
| 9785 | 9785 | 'supplier_proposal' => array( |
| 9786 | 9786 | 'enabled' => isModEnabled('supplier_proposal'), |
| 9787 | 9787 | 'perms' => 1, |
| 9788 | 9788 | 'label' => 'LinkToSupplierProposal', |
| 9789 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''), |
|
| 9789 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''), |
|
| 9790 | 9790 | ), |
| 9791 | 9791 | 'order_supplier' => array( |
| 9792 | 9792 | 'enabled' => isModEnabled("supplier_order"), |
| 9793 | 9793 | 'perms' => 1, |
| 9794 | 9794 | 'label' => 'LinkToSupplierOrder', |
| 9795 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''), |
|
| 9795 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''), |
|
| 9796 | 9796 | ), |
| 9797 | 9797 | 'invoice_supplier' => array( |
| 9798 | 9798 | 'enabled' => isModEnabled("supplier_invoice"), |
| 9799 | 9799 | 'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
| 9800 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('facture_fourn') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''), |
|
| 9800 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''), |
|
| 9801 | 9801 | ), |
| 9802 | 9802 | 'ticket' => array( |
| 9803 | 9803 | 'enabled' => isModEnabled('ticket'), |
| 9804 | 9804 | 'perms' => 1, |
| 9805 | 9805 | 'label' => 'LinkToTicket', |
| 9806 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('ticket') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : ''), |
|
| 9806 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : ''), |
|
| 9807 | 9807 | ), |
| 9808 | 9808 | 'mo' => array( |
| 9809 | 9809 | 'enabled' => isModEnabled('mrp'), |
| 9810 | 9810 | 'perms' => 1, |
| 9811 | 9811 | 'label' => 'LinkToMo', |
| 9812 | - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM " . $this->db->prefix() . "societe as s INNER JOIN " . $this->db->prefix() . "mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('mo') . ')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''), |
|
| 9812 | + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''), |
|
| 9813 | 9813 | ), |
| 9814 | 9814 | ); |
| 9815 | 9815 | } |
@@ -9851,23 +9851,23 @@ discard block |
||
| 9851 | 9851 | } |
| 9852 | 9852 | |
| 9853 | 9853 | if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
| 9854 | - $htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
| 9854 | + $htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
|
| 9855 | 9855 | |
| 9856 | 9856 | // Section for free ref input |
| 9857 | 9857 | if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { |
| 9858 | 9858 | $htmltoenteralink .= '<br>'."\n"; |
| 9859 | 9859 | $htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n"; |
| 9860 | - $htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
|
| 9861 | - $htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 9860 | + $htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
| 9861 | + $htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 9862 | 9862 | $htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">'; |
| 9863 | - $htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 9864 | - $htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
| 9863 | + $htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 9864 | + $htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; |
|
| 9865 | 9865 | $htmltoenteralink .= '<table class="noborder">'; |
| 9866 | 9866 | $htmltoenteralink .= '<tr class="liste_titre">'; |
| 9867 | 9867 | //print '<td>' . $langs->trans("Ref") . '</td>'; |
| 9868 | - $htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
|
| 9869 | - $htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
|
| 9870 | - $htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
| 9868 | + $htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
| 9869 | + $htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
| 9870 | + $htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
|
| 9871 | 9871 | $htmltoenteralink .= '</tr>'; |
| 9872 | 9872 | $htmltoenteralink .= '</table>'; |
| 9873 | 9873 | $htmltoenteralink .= '</form>'; |
@@ -9886,18 +9886,18 @@ discard block |
||
| 9886 | 9886 | $htmltoenteralink .= '<br>'; |
| 9887 | 9887 | } |
| 9888 | 9888 | $htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n"; |
| 9889 | - $htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
| 9890 | - $htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 9889 | + $htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
|
| 9890 | + $htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 9891 | 9891 | $htmltoenteralink .= '<input type="hidden" name="action" value="addlink">'; |
| 9892 | - $htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 9893 | - $htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
| 9892 | + $htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 9893 | + $htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; |
|
| 9894 | 9894 | $htmltoenteralink .= '<table class="noborder">'; |
| 9895 | 9895 | $htmltoenteralink .= '<tr class="liste_titre">'; |
| 9896 | 9896 | $htmltoenteralink .= '<td class="nowrap"></td>'; |
| 9897 | - $htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>'; |
|
| 9898 | - $htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>'; |
|
| 9899 | - $htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
|
| 9900 | - $htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>'; |
|
| 9897 | + $htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>'; |
|
| 9898 | + $htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>'; |
|
| 9899 | + $htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
| 9900 | + $htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>'; |
|
| 9901 | 9901 | $htmltoenteralink .= '</tr>'; |
| 9902 | 9902 | while ($i < $num) { |
| 9903 | 9903 | $objp = $this->db->fetch_object($resqllist); |
@@ -9912,30 +9912,30 @@ discard block |
||
| 9912 | 9912 | if ($alreadylinked) { |
| 9913 | 9913 | $htmltoenteralink .= img_picto('', 'link'); |
| 9914 | 9914 | } else { |
| 9915 | - $htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
| 9915 | + $htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
|
| 9916 | 9916 | } |
| 9917 | 9917 | $htmltoenteralink .= '</td>'; |
| 9918 | - $htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
|
| 9919 | - $htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
| 9918 | + $htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
| 9919 | + $htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
|
| 9920 | 9920 | $htmltoenteralink .= '<td class="right">'; |
| 9921 | 9921 | if ($possiblelink['label'] == 'LinkToContract') { |
| 9922 | - $htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
| 9922 | + $htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
|
| 9923 | 9923 | } |
| 9924 | - $htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
| 9924 | + $htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
|
| 9925 | 9925 | $htmltoenteralink .= '</td>'; |
| 9926 | - $htmltoenteralink .= '<td>' . $objp->name . '</td>'; |
|
| 9926 | + $htmltoenteralink .= '<td>'.$objp->name.'</td>'; |
|
| 9927 | 9927 | $htmltoenteralink .= '</tr>'; |
| 9928 | 9928 | $i++; |
| 9929 | 9929 | } |
| 9930 | 9930 | $htmltoenteralink .= '</table>'; |
| 9931 | 9931 | $htmltoenteralink .= '<div class="center">'; |
| 9932 | 9932 | if ($num) { |
| 9933 | - $htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="' . $langs->trans('ToLink') . '">'; |
|
| 9933 | + $htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="'.$langs->trans('ToLink').'">'; |
|
| 9934 | 9934 | } |
| 9935 | 9935 | if (empty($conf->use_javascript_ajax)) { |
| 9936 | - $htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
| 9936 | + $htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
|
| 9937 | 9937 | } else { |
| 9938 | - $htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
| 9938 | + $htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
|
| 9939 | 9939 | } |
| 9940 | 9940 | $htmltoenteralink .= '</form>'; |
| 9941 | 9941 | } |
@@ -9949,10 +9949,10 @@ discard block |
||
| 9949 | 9949 | |
| 9950 | 9950 | // Complete the list for the combo box |
| 9951 | 9951 | if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { |
| 9952 | - $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
| 9952 | + $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
|
| 9953 | 9953 | // } else $linktoelem.=$langs->trans($possiblelink['label']); |
| 9954 | 9954 | } else { |
| 9955 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
| 9955 | + $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
|
| 9956 | 9956 | } |
| 9957 | 9957 | } |
| 9958 | 9958 | } |
@@ -9962,11 +9962,11 @@ discard block |
||
| 9962 | 9962 | <dl class="dropdown" id="linktoobjectname"> |
| 9963 | 9963 | '; |
| 9964 | 9964 | if (!empty($conf->use_javascript_ajax)) { |
| 9965 | - $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
| 9965 | + $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
|
| 9966 | 9966 | } |
| 9967 | 9967 | $linktoelem .= '<dd> |
| 9968 | 9968 | <div class="multiselectlinkto"> |
| 9969 | - <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
| 9969 | + <ul class="ulselectedfields">' . $linktoelemlist.' |
|
| 9970 | 9970 | </ul> |
| 9971 | 9971 | </div> |
| 9972 | 9972 | </dd> |
@@ -9977,7 +9977,7 @@ discard block |
||
| 9977 | 9977 | |
| 9978 | 9978 | if (!empty($conf->use_javascript_ajax)) { |
| 9979 | 9979 | print '<!-- Add js to show linkto box --> |
| 9980 | - <script nonce="' . getNonce() . '"> |
|
| 9980 | + <script nonce="' . getNonce().'"> |
|
| 9981 | 9981 | jQuery(document).ready(function() { |
| 9982 | 9982 | jQuery(".linkto").click(function() { |
| 9983 | 9983 | console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
@@ -10024,19 +10024,19 @@ discard block |
||
| 10024 | 10024 | |
| 10025 | 10025 | $disabled = ($disabled ? ' disabled' : ''); |
| 10026 | 10026 | |
| 10027 | - $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
| 10027 | + $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
|
| 10028 | 10028 | if ($useempty) { |
| 10029 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
| 10029 | + $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
|
| 10030 | 10030 | } |
| 10031 | 10031 | if (("$value" == 'yes') || ($value == 1)) { |
| 10032 | - $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
|
| 10033 | - $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
| 10032 | + $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
| 10033 | + $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
|
| 10034 | 10034 | } else { |
| 10035 | 10035 | $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
| 10036 | - $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
|
| 10037 | - $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
| 10036 | + $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
| 10037 | + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
|
| 10038 | 10038 | } |
| 10039 | - $resultyesno .= '</select>' . "\n"; |
|
| 10039 | + $resultyesno .= '</select>'."\n"; |
|
| 10040 | 10040 | |
| 10041 | 10041 | if ($addjscombo) { |
| 10042 | 10042 | $resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
@@ -10060,12 +10060,12 @@ discard block |
||
| 10060 | 10060 | { |
| 10061 | 10061 | // phpcs:enable |
| 10062 | 10062 | $sql = "SELECT rowid, label"; |
| 10063 | - $sql .= " FROM " . $this->db->prefix() . "export_model"; |
|
| 10064 | - $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
| 10063 | + $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
| 10064 | + $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
|
| 10065 | 10065 | $sql .= " ORDER BY rowid"; |
| 10066 | 10066 | $result = $this->db->query($sql); |
| 10067 | 10067 | if ($result) { |
| 10068 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 10068 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 10069 | 10069 | if ($useempty) { |
| 10070 | 10070 | print '<option value="-1"> </option>'; |
| 10071 | 10071 | } |
@@ -10075,9 +10075,9 @@ discard block |
||
| 10075 | 10075 | while ($i < $num) { |
| 10076 | 10076 | $obj = $this->db->fetch_object($result); |
| 10077 | 10077 | if ($selected == $obj->rowid) { |
| 10078 | - print '<option value="' . $obj->rowid . '" selected>'; |
|
| 10078 | + print '<option value="'.$obj->rowid.'" selected>'; |
|
| 10079 | 10079 | } else { |
| 10080 | - print '<option value="' . $obj->rowid . '">'; |
|
| 10080 | + print '<option value="'.$obj->rowid.'">'; |
|
| 10081 | 10081 | } |
| 10082 | 10082 | print $obj->label; |
| 10083 | 10083 | print '</option>'; |
@@ -10168,8 +10168,8 @@ discard block |
||
| 10168 | 10168 | $stringforfirstkey .= ' CTL +'; |
| 10169 | 10169 | } |
| 10170 | 10170 | |
| 10171 | - $previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; |
|
| 10172 | - $next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; |
|
| 10171 | + $previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; |
|
| 10172 | + $next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; |
|
| 10173 | 10173 | } |
| 10174 | 10174 | |
| 10175 | 10175 | //print "xx".$previous_ref."x".$next_ref; |
@@ -10177,18 +10177,18 @@ discard block |
||
| 10177 | 10177 | |
| 10178 | 10178 | // Right part of banner |
| 10179 | 10179 | if ($morehtmlright) { |
| 10180 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
| 10180 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
|
| 10181 | 10181 | } |
| 10182 | 10182 | |
| 10183 | 10183 | if ($previous_ref || $next_ref || $morehtml) { |
| 10184 | 10184 | $ret .= '<div class="pagination paginationref"><ul class="right">'; |
| 10185 | 10185 | } |
| 10186 | 10186 | if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
| 10187 | - $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
| 10187 | + $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
|
| 10188 | 10188 | } |
| 10189 | 10189 | if ($shownav && ($previous_ref || $next_ref)) { |
| 10190 | - $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
|
| 10191 | - $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
| 10190 | + $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
| 10191 | + $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
|
| 10192 | 10192 | } |
| 10193 | 10193 | if ($previous_ref || $next_ref || $morehtml) { |
| 10194 | 10194 | $ret .= '</ul></div>'; |
@@ -10203,7 +10203,7 @@ discard block |
||
| 10203 | 10203 | $morehtmlstatus = $hookmanager->resPrint; |
| 10204 | 10204 | } |
| 10205 | 10205 | if ($morehtmlstatus) { |
| 10206 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
| 10206 | + $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
|
| 10207 | 10207 | } |
| 10208 | 10208 | |
| 10209 | 10209 | $parameters = array(); |
@@ -10217,14 +10217,14 @@ discard block |
||
| 10217 | 10217 | // Left part of banner |
| 10218 | 10218 | if ($morehtmlleft) { |
| 10219 | 10219 | if ($conf->browser->layout == 'phone') { |
| 10220 | - $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
| 10220 | + $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
|
| 10221 | 10221 | } else { |
| 10222 | - $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
| 10222 | + $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
|
| 10223 | 10223 | } |
| 10224 | 10224 | } |
| 10225 | 10225 | |
| 10226 | 10226 | //if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
| 10227 | - $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
| 10227 | + $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
|
| 10228 | 10228 | |
| 10229 | 10229 | // For thirdparty, contact, user, member, the ref is the id, so we show something else |
| 10230 | 10230 | if ($object->element == 'societe') { |
@@ -10238,7 +10238,7 @@ discard block |
||
| 10238 | 10238 | |
| 10239 | 10239 | if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
| 10240 | 10240 | if (!is_object($extralanguages)) { |
| 10241 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
| 10241 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
|
| 10242 | 10242 | $extralanguages = new ExtraLanguages($this->db); |
| 10243 | 10243 | } |
| 10244 | 10244 | $extralanguages->fetch_name_extralanguages('societe'); |
@@ -10253,21 +10253,21 @@ discard block |
||
| 10253 | 10253 | if ($object->array_languages['name'][$extralangcode]) { |
| 10254 | 10254 | $htmltext .= $object->array_languages['name'][$extralangcode]; |
| 10255 | 10255 | } else { |
| 10256 | - $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
| 10256 | + $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
|
| 10257 | 10257 | } |
| 10258 | 10258 | } |
| 10259 | - $ret .= '<!-- Show translations of name -->' . "\n"; |
|
| 10259 | + $ret .= '<!-- Show translations of name -->'."\n"; |
|
| 10260 | 10260 | $ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
| 10261 | 10261 | } |
| 10262 | 10262 | } |
| 10263 | 10263 | } elseif ($object->element == 'member') { |
| 10264 | 10264 | '@phan-var-force Adherent $object'; |
| 10265 | - $ret .= $object->ref . '<br>'; |
|
| 10265 | + $ret .= $object->ref.'<br>'; |
|
| 10266 | 10266 | $fullname = $object->getFullName($langs); |
| 10267 | 10267 | if ($object->morphy == 'mor' && $object->societe) { |
| 10268 | - $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
| 10268 | + $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
|
| 10269 | 10269 | } else { |
| 10270 | - $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
| 10270 | + $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
|
| 10271 | 10271 | } |
| 10272 | 10272 | } elseif (in_array($object->element, array('contact', 'user'))) { |
| 10273 | 10273 | $ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt; |
@@ -10275,7 +10275,7 @@ discard block |
||
| 10275 | 10275 | $ret .= dol_htmlentities($object->name); |
| 10276 | 10276 | } elseif (in_array($object->element, array('action', 'agenda'))) { |
| 10277 | 10277 | '@phan-var-force ActionComm $object'; |
| 10278 | - $ret .= $object->ref . '<br>' . $object->label; |
|
| 10278 | + $ret .= $object->ref.'<br>'.$object->label; |
|
| 10279 | 10279 | } elseif (in_array($object->element, array('adherent_type'))) { |
| 10280 | 10280 | $ret .= $object->label; |
| 10281 | 10281 | } elseif ($object->element == 'ecm_directories') { |
@@ -10328,9 +10328,9 @@ discard block |
||
| 10328 | 10328 | } |
| 10329 | 10329 | |
| 10330 | 10330 | // Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
| 10331 | - $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
|
| 10332 | - $out = '<!-- url barcode = ' . $url . ' -->'; |
|
| 10333 | - $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
| 10331 | + $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
| 10332 | + $out = '<!-- url barcode = '.$url.' -->'; |
|
| 10333 | + $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
|
| 10334 | 10334 | |
| 10335 | 10335 | return $out; |
| 10336 | 10336 | } |
@@ -10357,7 +10357,7 @@ discard block |
||
| 10357 | 10357 | global $conf, $langs; |
| 10358 | 10358 | |
| 10359 | 10359 | $entity = (empty($object->entity) ? $conf->entity : $object->entity); |
| 10360 | - $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
| 10360 | + $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
| 10361 | 10361 | |
| 10362 | 10362 | $dir = ''; |
| 10363 | 10363 | $file = ''; |
@@ -10370,28 +10370,28 @@ discard block |
||
| 10370 | 10370 | if (!empty($object->logo)) { |
| 10371 | 10371 | if (dolIsAllowedForPreview($object->logo)) { |
| 10372 | 10372 | if ((string) $imagesize == 'mini') { |
| 10373 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
| 10373 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
| 10374 | 10374 | } elseif ((string) $imagesize == 'small') { |
| 10375 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
| 10375 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
|
| 10376 | 10376 | } else { |
| 10377 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
| 10377 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
|
| 10378 | 10378 | } |
| 10379 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
| 10379 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
|
| 10380 | 10380 | } |
| 10381 | 10381 | } |
| 10382 | 10382 | $email = $object->email; |
| 10383 | 10383 | } elseif ($modulepart == 'contact') { |
| 10384 | - $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
| 10384 | + $dir = $conf->societe->multidir_output[$entity].'/contact'; |
|
| 10385 | 10385 | if (!empty($object->photo)) { |
| 10386 | 10386 | if (dolIsAllowedForPreview($object->photo)) { |
| 10387 | 10387 | if ((string) $imagesize == 'mini') { |
| 10388 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
| 10388 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
|
| 10389 | 10389 | } elseif ((string) $imagesize == 'small') { |
| 10390 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
| 10390 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
|
| 10391 | 10391 | } else { |
| 10392 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
| 10392 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
|
| 10393 | 10393 | } |
| 10394 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
| 10394 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
|
| 10395 | 10395 | } |
| 10396 | 10396 | } |
| 10397 | 10397 | $email = $object->email; |
@@ -10401,17 +10401,17 @@ discard block |
||
| 10401 | 10401 | if (!empty($object->photo)) { |
| 10402 | 10402 | if (dolIsAllowedForPreview($object->photo)) { |
| 10403 | 10403 | if ((string) $imagesize == 'mini') { |
| 10404 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
| 10404 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
|
| 10405 | 10405 | } elseif ((string) $imagesize == 'small') { |
| 10406 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
| 10406 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
|
| 10407 | 10407 | } else { |
| 10408 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
| 10408 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
|
| 10409 | 10409 | } |
| 10410 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
| 10410 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
|
| 10411 | 10411 | } |
| 10412 | 10412 | } |
| 10413 | 10413 | if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
| 10414 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
| 10414 | + $altfile = $object->id.".jpg"; // For backward compatibility |
|
| 10415 | 10415 | } |
| 10416 | 10416 | $email = $object->email; |
| 10417 | 10417 | $capture = 'user'; |
@@ -10420,17 +10420,17 @@ discard block |
||
| 10420 | 10420 | if (!empty($object->photo)) { |
| 10421 | 10421 | if (dolIsAllowedForPreview($object->photo)) { |
| 10422 | 10422 | if ((string) $imagesize == 'mini') { |
| 10423 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
| 10423 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
|
| 10424 | 10424 | } elseif ((string) $imagesize == 'small') { |
| 10425 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
| 10425 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
|
| 10426 | 10426 | } else { |
| 10427 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
| 10427 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
|
| 10428 | 10428 | } |
| 10429 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
| 10429 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
|
| 10430 | 10430 | } |
| 10431 | 10431 | } |
| 10432 | 10432 | if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
| 10433 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
| 10433 | + $altfile = $object->id.".jpg"; // For backward compatibility |
|
| 10434 | 10434 | } |
| 10435 | 10435 | $email = $object->email; |
| 10436 | 10436 | $capture = 'user'; |
@@ -10456,35 +10456,35 @@ discard block |
||
| 10456 | 10456 | $ret = ''; |
| 10457 | 10457 | |
| 10458 | 10458 | if ($dir) { |
| 10459 | - if ($file && file_exists($dir . "/" . $file)) { |
|
| 10459 | + if ($file && file_exists($dir."/".$file)) { |
|
| 10460 | 10460 | if ($addlinktofullsize) { |
| 10461 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
| 10461 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
|
| 10462 | 10462 | if ($urladvanced) { |
| 10463 | - $ret .= '<a href="' . $urladvanced . '">'; |
|
| 10463 | + $ret .= '<a href="'.$urladvanced.'">'; |
|
| 10464 | 10464 | } else { |
| 10465 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
| 10465 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
|
| 10466 | 10466 | } |
| 10467 | 10467 | } |
| 10468 | - $ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">'; |
|
| 10468 | + $ret .= '<img alt="" class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').' photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; |
|
| 10469 | 10469 | if ($addlinktofullsize) { |
| 10470 | 10470 | $ret .= '</a>'; |
| 10471 | 10471 | } |
| 10472 | - } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
| 10472 | + } elseif ($altfile && file_exists($dir."/".$altfile)) { |
|
| 10473 | 10473 | if ($addlinktofullsize) { |
| 10474 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
| 10474 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
|
| 10475 | 10475 | if ($urladvanced) { |
| 10476 | - $ret .= '<a href="' . $urladvanced . '">'; |
|
| 10476 | + $ret .= '<a href="'.$urladvanced.'">'; |
|
| 10477 | 10477 | } else { |
| 10478 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
| 10478 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
|
| 10479 | 10479 | } |
| 10480 | 10480 | } |
| 10481 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">'; |
|
| 10481 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" class="'.$cssclass.'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">'; |
|
| 10482 | 10482 | if ($addlinktofullsize) { |
| 10483 | 10483 | $ret .= '</a>'; |
| 10484 | 10484 | } |
| 10485 | 10485 | } else { |
| 10486 | 10486 | $nophoto = '/public/theme/common/nophoto.png'; |
| 10487 | - $defaultimg = 'identicon'; // For gravatar |
|
| 10487 | + $defaultimg = 'identicon'; // For gravatar |
|
| 10488 | 10488 | if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
| 10489 | 10489 | if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
| 10490 | 10490 | $nophoto = 'company'; |
@@ -10502,13 +10502,13 @@ discard block |
||
| 10502 | 10502 | if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
| 10503 | 10503 | // see https://gravatar.com/site/implement/images/php/ |
| 10504 | 10504 | $ret .= '<!-- Put link to gravatar -->'; |
| 10505 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash |
|
| 10505 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 'sha256', 1).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash |
|
| 10506 | 10506 | } else { |
| 10507 | 10507 | if ($nophoto == 'company') { |
| 10508 | - $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
| 10508 | + $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
|
| 10509 | 10509 | //$ret .= '<div class="difforspanimgright"></div>'; |
| 10510 | 10510 | } else { |
| 10511 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
| 10511 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
|
| 10512 | 10512 | } |
| 10513 | 10513 | } |
| 10514 | 10514 | } |
@@ -10519,15 +10519,15 @@ discard block |
||
| 10519 | 10519 | } |
| 10520 | 10520 | $ret .= '<table class="nobordernopadding centpercent">'; |
| 10521 | 10521 | if ($object->photo) { |
| 10522 | - $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
| 10522 | + $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
|
| 10523 | 10523 | } |
| 10524 | 10524 | $ret .= '<tr><td class="tdoverflow">'; |
| 10525 | 10525 | $maxfilesizearray = getMaxFileSizeArray(); |
| 10526 | 10526 | $maxmin = $maxfilesizearray['maxmin']; |
| 10527 | 10527 | if ($maxmin > 0) { |
| 10528 | - $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 10528 | + $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 10529 | 10529 | } |
| 10530 | - $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
| 10530 | + $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
|
| 10531 | 10531 | $ret .= '</td></tr>'; |
| 10532 | 10532 | $ret .= '</table>'; |
| 10533 | 10533 | } |
@@ -10581,38 +10581,38 @@ discard block |
||
| 10581 | 10581 | if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
| 10582 | 10582 | $sql .= ", e.label"; |
| 10583 | 10583 | } |
| 10584 | - $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
| 10584 | + $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
|
| 10585 | 10585 | if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
| 10586 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
| 10586 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
|
| 10587 | 10587 | if ($force_entity) { |
| 10588 | - $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
| 10588 | + $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
|
| 10589 | 10589 | } else { |
| 10590 | 10590 | $sql .= " WHERE ug.entity IS NOT NULL"; |
| 10591 | 10591 | } |
| 10592 | 10592 | } else { |
| 10593 | - $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
| 10593 | + $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
|
| 10594 | 10594 | } |
| 10595 | 10595 | if (is_array($exclude) && $excludeGroups) { |
| 10596 | - $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
| 10596 | + $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
|
| 10597 | 10597 | } |
| 10598 | 10598 | if (is_array($include) && $includeGroups) { |
| 10599 | - $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
| 10599 | + $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
|
| 10600 | 10600 | } |
| 10601 | 10601 | $sql .= " ORDER BY ug.nom ASC"; |
| 10602 | 10602 | |
| 10603 | - dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
| 10603 | + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
|
| 10604 | 10604 | $resql = $this->db->query($sql); |
| 10605 | 10605 | if ($resql) { |
| 10606 | 10606 | // Enhance with select2 |
| 10607 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 10607 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 10608 | 10608 | |
| 10609 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
| 10609 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
|
| 10610 | 10610 | |
| 10611 | 10611 | $num = $this->db->num_rows($resql); |
| 10612 | 10612 | $i = 0; |
| 10613 | 10613 | if ($num) { |
| 10614 | 10614 | if ($show_empty && !$multiple) { |
| 10615 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
| 10615 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
|
| 10616 | 10616 | } |
| 10617 | 10617 | |
| 10618 | 10618 | while ($i < $num) { |
@@ -10625,11 +10625,11 @@ discard block |
||
| 10625 | 10625 | $label = $obj->name; |
| 10626 | 10626 | $labelhtml = $obj->name; |
| 10627 | 10627 | if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
| 10628 | - $label .= " (" . $obj->label . ")"; |
|
| 10629 | - $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
| 10628 | + $label .= " (".$obj->label.")"; |
|
| 10629 | + $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
|
| 10630 | 10630 | } |
| 10631 | 10631 | |
| 10632 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 10632 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 10633 | 10633 | if ($disableline) { |
| 10634 | 10634 | $out .= ' disabled'; |
| 10635 | 10635 | } |
@@ -10645,9 +10645,9 @@ discard block |
||
| 10645 | 10645 | } |
| 10646 | 10646 | } else { |
| 10647 | 10647 | if ($show_empty) { |
| 10648 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
| 10648 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
|
| 10649 | 10649 | } |
| 10650 | - $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
| 10650 | + $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
|
| 10651 | 10651 | } |
| 10652 | 10652 | $out .= '</select>'; |
| 10653 | 10653 | |
@@ -10691,25 +10691,25 @@ discard block |
||
| 10691 | 10691 | $out = ''; |
| 10692 | 10692 | |
| 10693 | 10693 | if (!empty($conf->use_javascript_ajax)) { |
| 10694 | - $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
| 10694 | + $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
|
| 10695 | 10695 | } |
| 10696 | - $out .= '<script nonce="' . getNonce() . '"> |
|
| 10696 | + $out .= '<script nonce="'.getNonce().'"> |
|
| 10697 | 10697 | $(document).ready(function() { |
| 10698 | - $("#' . $cssclass . 's").click(function() { |
|
| 10698 | + $("#' . $cssclass.'s").click(function() { |
|
| 10699 | 10699 | if($(this).is(\':checked\')){ |
| 10700 | - console.log("We check all ' . $cssclass . ' and trigger the change method"); |
|
| 10701 | - $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
| 10700 | + console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
| 10701 | + $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
|
| 10702 | 10702 | } |
| 10703 | 10703 | else |
| 10704 | 10704 | { |
| 10705 | 10705 | console.log("We uncheck all"); |
| 10706 | - $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
| 10706 | + $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
|
| 10707 | 10707 | }' . "\n"; |
| 10708 | 10708 | if ($calljsfunction) { |
| 10709 | - $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
| 10709 | + $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
| 10710 | 10710 | } |
| 10711 | 10711 | $out .= ' }); |
| 10712 | - $(".' . $cssclass . '").change(function() { |
|
| 10712 | + $(".' . $cssclass.'").change(function() { |
|
| 10713 | 10713 | $(this).closest("tr").toggleClass("highlight", this.checked); |
| 10714 | 10714 | }); |
| 10715 | 10715 | }); |
@@ -10754,67 +10754,67 @@ discard block |
||
| 10754 | 10754 | global $langs, $user; |
| 10755 | 10755 | |
| 10756 | 10756 | $out = ''; |
| 10757 | - $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
|
| 10758 | - $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
| 10757 | + $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
| 10758 | + $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
|
| 10759 | 10759 | if (!empty($excludeid)) { |
| 10760 | - $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
| 10760 | + $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
|
| 10761 | 10761 | } |
| 10762 | 10762 | $sql .= " ORDER BY label"; |
| 10763 | 10763 | |
| 10764 | 10764 | $resql = $this->db->query($sql); |
| 10765 | 10765 | if ($resql) { |
| 10766 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
| 10766 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
|
| 10767 | 10767 | if ($useempty) { |
| 10768 | 10768 | $out .= '<option value="0"> </option>'; |
| 10769 | 10769 | } |
| 10770 | 10770 | |
| 10771 | 10771 | while ($obj = $this->db->fetch_object($resql)) { |
| 10772 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
| 10772 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
|
| 10773 | 10773 | } |
| 10774 | 10774 | $out .= '</select>'; |
| 10775 | - $out .= ajax_combobox('select_' . $htmlname); |
|
| 10775 | + $out .= ajax_combobox('select_'.$htmlname); |
|
| 10776 | 10776 | |
| 10777 | 10777 | if (!empty($htmlname) && $user->admin && $info_admin) { |
| 10778 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 10778 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 10779 | 10779 | } |
| 10780 | 10780 | |
| 10781 | 10781 | if (!empty($target)) { |
| 10782 | - $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
| 10782 | + $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
| 10783 | 10783 | $resql = $this->db->query($sql); |
| 10784 | 10784 | if ($resql) { |
| 10785 | 10785 | if ($this->db->num_rows($resql) > 0) { |
| 10786 | 10786 | $obj = $this->db->fetch_object($resql); |
| 10787 | - $out .= '<script nonce="' . getNonce() . '"> |
|
| 10787 | + $out .= '<script nonce="'.getNonce().'"> |
|
| 10788 | 10788 | $(function() { |
| 10789 | - $("select[name=' . $target . ']").on("change", function() { |
|
| 10789 | + $("select[name=' . $target.']").on("change", function() { |
|
| 10790 | 10790 | var current_val = $(this).val(); |
| 10791 | - if (current_val == ' . $obj->id . ') {'; |
|
| 10791 | + if (current_val == ' . $obj->id.') {'; |
|
| 10792 | 10792 | if (!empty($default_selected) || !empty($selected)) { |
| 10793 | - $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
| 10793 | + $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
|
| 10794 | 10794 | } |
| 10795 | 10795 | |
| 10796 | 10796 | $out .= ' |
| 10797 | - $("select[name=' . $htmlname . ']").change(); |
|
| 10797 | + $("select[name=' . $htmlname.']").change(); |
|
| 10798 | 10798 | } |
| 10799 | 10799 | }); |
| 10800 | 10800 | |
| 10801 | - $("select[name=' . $htmlname . ']").change(function() { |
|
| 10801 | + $("select[name=' . $htmlname.']").change(function() { |
|
| 10802 | 10802 | |
| 10803 | - if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
| 10803 | + if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
|
| 10804 | 10804 | // get price of kilometer to fill the unit price |
| 10805 | 10805 | $.ajax({ |
| 10806 | 10806 | method: "POST", |
| 10807 | 10807 | dataType: "json", |
| 10808 | - data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
|
| 10809 | - url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
| 10808 | + data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
| 10809 | + url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
|
| 10810 | 10810 | }).done(function( data, textStatus, jqXHR ) { |
| 10811 | 10811 | console.log(data); |
| 10812 | 10812 | if (typeof data.up != "undefined") { |
| 10813 | 10813 | $("input[name=value_unit]").val(data.up); |
| 10814 | - $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
| 10814 | + $("select[name=' . $htmlname.']").attr("title", data.title); |
|
| 10815 | 10815 | } else { |
| 10816 | 10816 | $("input[name=value_unit]").val(""); |
| 10817 | - $("select[name=' . $htmlname . ']").attr("title", ""); |
|
| 10817 | + $("select[name=' . $htmlname.']").attr("title", ""); |
|
| 10818 | 10818 | } |
| 10819 | 10819 | }); |
| 10820 | 10820 | } |
@@ -10844,18 +10844,18 @@ discard block |
||
| 10844 | 10844 | global $conf, $langs; |
| 10845 | 10845 | |
| 10846 | 10846 | $out = ''; |
| 10847 | - $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
|
| 10848 | - $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
| 10847 | + $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
| 10848 | + $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
|
| 10849 | 10849 | |
| 10850 | 10850 | $resql = $this->db->query($sql); |
| 10851 | 10851 | if ($resql) { |
| 10852 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
| 10852 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
|
| 10853 | 10853 | if ($useempty) { |
| 10854 | 10854 | $out .= '<option value="0"></option>'; |
| 10855 | 10855 | } |
| 10856 | 10856 | |
| 10857 | 10857 | while ($obj = $this->db->fetch_object($resql)) { |
| 10858 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
| 10858 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
|
| 10859 | 10859 | } |
| 10860 | 10860 | $out .= '</select>'; |
| 10861 | 10861 | } else { |
@@ -10886,12 +10886,12 @@ discard block |
||
| 10886 | 10886 | |
| 10887 | 10887 | $resql = $this->db->query($sql); |
| 10888 | 10888 | if ($resql) { |
| 10889 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
| 10889 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
|
| 10890 | 10890 | if ($useempty) { |
| 10891 | 10891 | $out .= '<option value="0"></option>'; |
| 10892 | 10892 | } |
| 10893 | 10893 | if ($allchoice) { |
| 10894 | - $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
| 10894 | + $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
|
| 10895 | 10895 | } |
| 10896 | 10896 | |
| 10897 | 10897 | $field = 'code'; |
@@ -10901,7 +10901,7 @@ discard block |
||
| 10901 | 10901 | |
| 10902 | 10902 | while ($obj = $this->db->fetch_object($resql)) { |
| 10903 | 10903 | $key = $langs->trans($obj->code); |
| 10904 | - $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
| 10904 | + $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
|
| 10905 | 10905 | } |
| 10906 | 10906 | $out .= '</select>'; |
| 10907 | 10907 | |
@@ -10935,7 +10935,7 @@ discard block |
||
| 10935 | 10935 | { |
| 10936 | 10936 | global $user, $conf, $langs; |
| 10937 | 10937 | |
| 10938 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 10938 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 10939 | 10939 | |
| 10940 | 10940 | if (is_null($usertofilter)) { |
| 10941 | 10941 | $usertofilter = $user; |
@@ -10959,10 +10959,10 @@ discard block |
||
| 10959 | 10959 | $sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
| 10960 | 10960 | p.title, p.fk_soc, p.fk_statut, p.public,"; |
| 10961 | 10961 | $sql .= ' s.nom as name'; |
| 10962 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
|
| 10963 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
|
| 10964 | - $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
|
| 10965 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 10962 | + $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
| 10963 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
| 10964 | + $sql .= ' '.$this->db->prefix().'facture as f'; |
|
| 10965 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 10966 | 10966 | $sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
| 10967 | 10967 | //if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
| 10968 | 10968 | //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
@@ -10973,14 +10973,14 @@ discard block |
||
| 10973 | 10973 | if ($resql) { |
| 10974 | 10974 | // Use select2 selector |
| 10975 | 10975 | if (!empty($conf->use_javascript_ajax)) { |
| 10976 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 10976 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 10977 | 10977 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
| 10978 | 10978 | $out .= $comboenhancement; |
| 10979 | 10979 | $morecss = 'minwidth200imp maxwidth500'; |
| 10980 | 10980 | } |
| 10981 | 10981 | |
| 10982 | 10982 | if (empty($option_only)) { |
| 10983 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 10983 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 10984 | 10984 | } |
| 10985 | 10985 | if (!empty($show_empty)) { |
| 10986 | 10986 | $out .= '<option value="0" class="optiongrey">'; |
@@ -11010,33 +11010,33 @@ discard block |
||
| 11010 | 11010 | if ($showproject == 'all') { |
| 11011 | 11011 | $labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
| 11012 | 11012 | if ($obj->name) { |
| 11013 | - $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
| 11013 | + $labeltoshow .= ' - '.$obj->name; // Soc name |
|
| 11014 | 11014 | } |
| 11015 | 11015 | |
| 11016 | 11016 | $disabled = 0; |
| 11017 | 11017 | if ($obj->fk_statut == Project::STATUS_DRAFT) { |
| 11018 | 11018 | $disabled = 1; |
| 11019 | - $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
| 11019 | + $labeltoshow .= ' - '.$langs->trans("Draft"); |
|
| 11020 | 11020 | } elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
| 11021 | 11021 | if ($discard_closed == 2) { |
| 11022 | 11022 | $disabled = 1; |
| 11023 | 11023 | } |
| 11024 | - $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
| 11024 | + $labeltoshow .= ' - '.$langs->trans("Closed"); |
|
| 11025 | 11025 | } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
| 11026 | 11026 | $disabled = 1; |
| 11027 | - $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
| 11027 | + $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
|
| 11028 | 11028 | } |
| 11029 | 11029 | } |
| 11030 | 11030 | |
| 11031 | 11031 | if (!empty($selected) && $selected == $obj->rowid) { |
| 11032 | - $out .= '<option value="' . $obj->rowid . '" selected'; |
|
| 11032 | + $out .= '<option value="'.$obj->rowid.'" selected'; |
|
| 11033 | 11033 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
| 11034 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 11034 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 11035 | 11035 | } else { |
| 11036 | 11036 | if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
| 11037 | 11037 | $resultat = ''; |
| 11038 | 11038 | } else { |
| 11039 | - $resultat = '<option value="' . $obj->rowid . '"'; |
|
| 11039 | + $resultat = '<option value="'.$obj->rowid.'"'; |
|
| 11040 | 11040 | if ($disabled) { |
| 11041 | 11041 | $resultat .= ' disabled'; |
| 11042 | 11042 | } |
@@ -11088,22 +11088,22 @@ discard block |
||
| 11088 | 11088 | |
| 11089 | 11089 | $sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
| 11090 | 11090 | //$sql.= ', el.fk_source'; |
| 11091 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
|
| 11092 | - $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
| 11091 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
| 11092 | + $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
|
| 11093 | 11093 | $sql .= " ORDER BY f.titre ASC"; |
| 11094 | 11094 | |
| 11095 | 11095 | $resql = $this->db->query($sql); |
| 11096 | 11096 | if ($resql) { |
| 11097 | 11097 | // Use select2 selector |
| 11098 | 11098 | if (!empty($conf->use_javascript_ajax)) { |
| 11099 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 11099 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 11100 | 11100 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
| 11101 | 11101 | $out .= $comboenhancement; |
| 11102 | 11102 | $morecss = 'minwidth200imp maxwidth500'; |
| 11103 | 11103 | } |
| 11104 | 11104 | |
| 11105 | 11105 | if (empty($option_only)) { |
| 11106 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 11106 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 11107 | 11107 | } |
| 11108 | 11108 | if (!empty($show_empty)) { |
| 11109 | 11109 | $out .= '<option value="0" class="optiongrey">'; |
@@ -11122,19 +11122,19 @@ discard block |
||
| 11122 | 11122 | $disabled = 0; |
| 11123 | 11123 | if (!empty($obj->suspended)) { |
| 11124 | 11124 | $disabled = 1; |
| 11125 | - $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
| 11125 | + $labeltoshow .= ' - '.$langs->trans("Closed"); |
|
| 11126 | 11126 | } |
| 11127 | 11127 | |
| 11128 | 11128 | |
| 11129 | 11129 | if (!empty($selected) && $selected == $obj->rowid) { |
| 11130 | - $out .= '<option value="' . $obj->rowid . '" selected'; |
|
| 11130 | + $out .= '<option value="'.$obj->rowid.'" selected'; |
|
| 11131 | 11131 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
| 11132 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 11132 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 11133 | 11133 | } else { |
| 11134 | 11134 | if ($disabled && ($selected != $obj->rowid)) { |
| 11135 | 11135 | $resultat = ''; |
| 11136 | 11136 | } else { |
| 11137 | - $resultat = '<option value="' . $obj->rowid . '"'; |
|
| 11137 | + $resultat = '<option value="'.$obj->rowid.'"'; |
|
| 11138 | 11138 | if ($disabled) { |
| 11139 | 11139 | $resultat .= ' disabled'; |
| 11140 | 11140 | } |
@@ -11179,14 +11179,14 @@ discard block |
||
| 11179 | 11179 | $formother = new FormOther($this->db); |
| 11180 | 11180 | |
| 11181 | 11181 | if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
| 11182 | - $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
| 11182 | + $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
|
| 11183 | 11183 | } |
| 11184 | 11184 | |
| 11185 | 11185 | $ret = ''; |
| 11186 | 11186 | |
| 11187 | 11187 | $ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
| 11188 | 11188 | $ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
| 11189 | - $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
| 11189 | + $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
|
| 11190 | 11190 | $ret .= '</a>'; |
| 11191 | 11191 | |
| 11192 | 11192 | $ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
@@ -11230,30 +11230,30 @@ discard block |
||
| 11230 | 11230 | $ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
| 11231 | 11231 | } |
| 11232 | 11232 | $ret .= "<!-- We store the full Universal Search String into this field. For example: (t.ref:like:'SO-%') AND ((t.ref:like:'CO-%') OR (t.ref:like:'AA%')) -->"; |
| 11233 | - $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
| 11233 | + $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
|
| 11234 | 11234 | // $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
| 11235 | 11235 | |
| 11236 | 11236 | // TODO : Use $arrayoffiltercriterias instead of $arrayofcriterias |
| 11237 | 11237 | // For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
| 11238 | 11238 | foreach ($arrayofcriterias as $criteria) { |
| 11239 | 11239 | foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
| 11240 | - if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
| 11240 | + if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
| 11241 | 11241 | continue; |
| 11242 | 11242 | } |
| 11243 | 11243 | if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
| 11244 | 11244 | continue; |
| 11245 | 11245 | } |
| 11246 | 11246 | if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
| 11247 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
|
| 11248 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
|
| 11249 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
|
| 11250 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
|
| 11251 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
|
| 11252 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
|
| 11253 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
|
| 11254 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
| 11247 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
| 11248 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
| 11249 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
| 11250 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
| 11251 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
| 11252 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
| 11253 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
| 11254 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
|
| 11255 | 11255 | } else { |
| 11256 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
| 11256 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
|
| 11257 | 11257 | } |
| 11258 | 11258 | } |
| 11259 | 11259 | } |
@@ -11261,7 +11261,7 @@ discard block |
||
| 11261 | 11261 | $ret .= '</div>'; |
| 11262 | 11262 | |
| 11263 | 11263 | $ret .= "<!-- Field to enter a generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n"; |
| 11264 | - $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
| 11264 | + $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
| 11265 | 11265 | |
| 11266 | 11266 | $ret .= '</div>'; |
| 11267 | 11267 | $ret .= '</div>'; |
@@ -11318,7 +11318,7 @@ discard block |
||
| 11318 | 11318 | // Convert $arrayoffiltercriterias into a json object that can be used in jquery to build the search component dynamically |
| 11319 | 11319 | $arrayoffiltercriterias_json = json_encode($arrayoffiltercriterias); |
| 11320 | 11320 | $ret .= '<script> |
| 11321 | - var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json . '; |
|
| 11321 | + var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json.'; |
|
| 11322 | 11322 | </script>'; |
| 11323 | 11323 | |
| 11324 | 11324 | |
@@ -11332,9 +11332,9 @@ discard block |
||
| 11332 | 11332 | $ret .= '<div class="search-component-assistance">'; |
| 11333 | 11333 | $ret .= '<div>'; |
| 11334 | 11334 | |
| 11335 | - $ret .= '<p class="assistance-title">' . img_picto('', 'filter') . ' ' . $langs->trans('FilterAssistance') . ' </p>'; |
|
| 11335 | + $ret .= '<p class="assistance-title">'.img_picto('', 'filter').' '.$langs->trans('FilterAssistance').' </p>'; |
|
| 11336 | 11336 | |
| 11337 | - $ret .= '<p class="assistance-errors error" style="display:none">' . $langs->trans('AllFieldsRequired') . ' </p>'; |
|
| 11337 | + $ret .= '<p class="assistance-errors error" style="display:none">'.$langs->trans('AllFieldsRequired').' </p>'; |
|
| 11338 | 11338 | |
| 11339 | 11339 | $ret .= '<div class="operand">'; |
| 11340 | 11340 | $ret .= $form->selectarray('search_filter_field', $arrayoffilterfieldslabel, '', $langs->trans("Fields"), 0, 0, '', 0, 0, 0, '', 'width250', 1); |
@@ -11348,7 +11348,7 @@ discard block |
||
| 11348 | 11348 | $ret .= '</select>'; |
| 11349 | 11349 | $ret .= '<script>$(document).ready(function() {'; |
| 11350 | 11350 | $ret .= ' $(".operator-selector").select2({'; |
| 11351 | - $ret .= ' placeholder: \'' . dol_escape_js($langs->trans('Operator')) . '\''; |
|
| 11351 | + $ret .= ' placeholder: \''.dol_escape_js($langs->trans('Operator')).'\''; |
|
| 11352 | 11352 | $ret .= ' });'; |
| 11353 | 11353 | $ret .= '});</script>'; |
| 11354 | 11354 | $ret .= '</div>'; |
@@ -11357,12 +11357,12 @@ discard block |
||
| 11357 | 11357 | |
| 11358 | 11358 | $ret .= '<div class="value">'; |
| 11359 | 11359 | // Input field for entering values |
| 11360 | - $ret .= '<input type="text" class="flat width100 value-input" placeholder="' . dolPrintHTML($langs->trans('Value')) . '">'; |
|
| 11360 | + $ret .= '<input type="text" class="flat width100 value-input" placeholder="'.dolPrintHTML($langs->trans('Value')).'">'; |
|
| 11361 | 11361 | |
| 11362 | 11362 | // Date selector |
| 11363 | 11363 | $dateOne = ''; |
| 11364 | 11364 | $ret .= '<span class="date-one" style="display:none">'; |
| 11365 | - $ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, ''); |
|
| 11365 | + $ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, ''); |
|
| 11366 | 11366 | $ret .= '</span>'; |
| 11367 | 11367 | |
| 11368 | 11368 | // Value selector (will be populated dynamically) based on search_filter_field value if a selected value has an array of values |
@@ -11371,7 +11371,7 @@ discard block |
||
| 11371 | 11371 | $ret .= '<script> |
| 11372 | 11372 | $(document).ready(function() { |
| 11373 | 11373 | $("#value-selector").select2({ |
| 11374 | - placeholder: "' . dol_escape_js($langs->trans('Value')) . '" |
|
| 11374 | + placeholder: "' . dol_escape_js($langs->trans('Value')).'" |
|
| 11375 | 11375 | }); |
| 11376 | 11376 | $("#value-selector").hide(); |
| 11377 | 11377 | $("#value-selector").next(".select2-container").hide(); |
@@ -11381,7 +11381,7 @@ discard block |
||
| 11381 | 11381 | $ret .= '</div>'; |
| 11382 | 11382 | |
| 11383 | 11383 | $ret .= '<div class="btn-div">'; |
| 11384 | - $ret .= '<button class="button buttongen button-save add-filter-btn" type="button">' . $langs->trans("addToFilter") . '</button>'; |
|
| 11384 | + $ret .= '<button class="button buttongen button-save add-filter-btn" type="button">'.$langs->trans("addToFilter").'</button>'; |
|
| 11385 | 11385 | $ret .= '</div>'; |
| 11386 | 11386 | |
| 11387 | 11387 | $ret .= '</div>'; |
@@ -11547,7 +11547,7 @@ discard block |
||
| 11547 | 11547 | |
| 11548 | 11548 | $TModels = array(); |
| 11549 | 11549 | |
| 11550 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
| 11550 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
| 11551 | 11551 | $formmail = new FormMail($this->db); |
| 11552 | 11552 | $result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
| 11553 | 11553 | |
@@ -11560,20 +11560,20 @@ discard block |
||
| 11560 | 11560 | } |
| 11561 | 11561 | } |
| 11562 | 11562 | |
| 11563 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
| 11563 | + $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
|
| 11564 | 11564 | |
| 11565 | 11565 | foreach ($TModels as $id_model => $label_model) { |
| 11566 | - $retstring .= '<option value="' . $id_model . '"'; |
|
| 11566 | + $retstring .= '<option value="'.$id_model.'"'; |
|
| 11567 | 11567 | if (!empty($selected) && $selected == $id_model) { |
| 11568 | 11568 | $retstring .= "selected"; |
| 11569 | 11569 | } |
| 11570 | - $retstring .= ">" . $label_model . "</option>"; |
|
| 11570 | + $retstring .= ">".$label_model."</option>"; |
|
| 11571 | 11571 | } |
| 11572 | 11572 | |
| 11573 | 11573 | $retstring .= "</select>"; |
| 11574 | 11574 | |
| 11575 | 11575 | if ($addjscombo) { |
| 11576 | - $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
| 11576 | + $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
|
| 11577 | 11577 | } |
| 11578 | 11578 | |
| 11579 | 11579 | return $retstring; |
@@ -11624,16 +11624,16 @@ discard block |
||
| 11624 | 11624 | |
| 11625 | 11625 | foreach ($buttons as $button) { |
| 11626 | 11626 | $addclass = empty($button['addclass']) ? '' : $button['addclass']; |
| 11627 | - $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
| 11627 | + $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
|
| 11628 | 11628 | } |
| 11629 | 11629 | $retstring .= $withoutdiv ? '' : '</div>'; |
| 11630 | 11630 | |
| 11631 | 11631 | if ($dol_openinpopup) { |
| 11632 | - $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
|
| 11633 | - $retstring .= '<script nonce="' . getNonce() . '">'; |
|
| 11632 | + $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n"; |
|
| 11633 | + $retstring .= '<script nonce="'.getNonce().'">'; |
|
| 11634 | 11634 | $retstring .= 'jQuery(".button-cancel").click(function(e) { |
| 11635 | - e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\'); |
|
| 11636 | - window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\'); |
|
| 11635 | + e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\'); |
|
| 11636 | + window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\'); |
|
| 11637 | 11637 | });'; |
| 11638 | 11638 | $retstring .= '</script>'; |
| 11639 | 11639 | } |
@@ -11662,7 +11662,7 @@ discard block |
||
| 11662 | 11662 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 11663 | 11663 | |
| 11664 | 11664 | $sql = "SELECT rowid, code, label as label"; |
| 11665 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
| 11665 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
|
| 11666 | 11666 | $sql .= " WHERE active = 1"; |
| 11667 | 11667 | |
| 11668 | 11668 | $resql = $this->db->query($sql); |
@@ -11673,7 +11673,7 @@ discard block |
||
| 11673 | 11673 | $obj = $this->db->fetch_object($resql); |
| 11674 | 11674 | |
| 11675 | 11675 | // If translation exists, we use it, otherwise we take the default wording |
| 11676 | - $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
| 11676 | + $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
| 11677 | 11677 | $this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
| 11678 | 11678 | $this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
| 11679 | 11679 | $this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
@@ -11705,18 +11705,18 @@ discard block |
||
| 11705 | 11705 | global $langs, $user; |
| 11706 | 11706 | |
| 11707 | 11707 | $out = ''; |
| 11708 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
| 11708 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
| 11709 | 11709 | |
| 11710 | 11710 | $this->load_cache_invoice_subtype(); |
| 11711 | 11711 | |
| 11712 | - $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
| 11712 | + $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
| 11713 | 11713 | if ($addempty) { |
| 11714 | 11714 | $out .= '<option value="0"> </option>'; |
| 11715 | 11715 | } |
| 11716 | 11716 | |
| 11717 | 11717 | foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
| 11718 | 11718 | $label = $subtype['label']; |
| 11719 | - $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
| 11719 | + $out .= '<option value="'.$subtype['rowid'].'"'; |
|
| 11720 | 11720 | if ($selected == $subtype['rowid']) { |
| 11721 | 11721 | $out .= ' selected="selected"'; |
| 11722 | 11722 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; |
| 45 | 45 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
| 46 | 46 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
| 47 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/public.lib.php'; |
|
| 47 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/public.lib.php'; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @var Conf $conf |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | $action = GETPOST('action', 'aZ09'); |
| 62 | 62 | $cancel = GETPOST('cancel', 'alpha'); |
| 63 | 63 | $email = GETPOST('email', 'alpha'); |
| 64 | -$firstname = GETPOST('firstname', 'alpha'); |
|
| 64 | +$firstname = GETPOST('firstname', 'alpha'); |
|
| 65 | 65 | $lastname = GETPOST('lastname', 'alpha'); |
| 66 | 66 | $birthday = GETPOST('birthday', 'alpha'); |
| 67 | -$phone = GETPOST('phone', 'alpha'); |
|
| 68 | -$message = GETPOST('message', 'alpha'); |
|
| 67 | +$phone = GETPOST('phone', 'alpha'); |
|
| 68 | +$message = GETPOST('message', 'alpha'); |
|
| 69 | 69 | $requestedremuneration = GETPOST('requestedremuneration', 'alpha'); |
| 70 | 70 | |
| 71 | 71 | $ref = GETPOST('ref', 'alpha'); |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | if (!$error) { |
| 140 | 140 | $sql = "SELECT rrc.rowid FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rrc"; |
| 141 | - $sql .= " WHERE rrc.email = '". $db->escape($email)."'"; |
|
| 142 | - $sql .= " AND rrc.entity IN (". getEntity($object->element, 0).")"; |
|
| 141 | + $sql .= " WHERE rrc.email = '".$db->escape($email)."'"; |
|
| 142 | + $sql .= " AND rrc.entity IN (".getEntity($object->element, 0).")"; |
|
| 143 | 143 | $resql = $db->query($sql); |
| 144 | 144 | if ($resql) { |
| 145 | 145 | $num = $db->num_rows($resql); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if (!$error) { |
| 194 | 194 | $db->commit(); |
| 195 | 195 | setEventMessages($langs->trans("RecruitmentCandidatureSaved"), null); |
| 196 | - header("Location: " . $backtopage); |
|
| 196 | + header("Location: ".$backtopage); |
|
| 197 | 197 | exit; |
| 198 | 198 | } else { |
| 199 | 199 | $db->rollback(); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | $head = ''; |
| 221 | 221 | if (getDolGlobalString('MAIN_RECRUITMENT_CSS_URL')) { |
| 222 | - $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_RECRUITMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 222 | + $head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('MAIN_RECRUITMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $conf->dol_hide_topmenu = 1; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | if (getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE')) { |
| 294 | 294 | print '<div class="backimagepublicrecruitment">'; |
| 295 | - print '<img id="idRECRUITMENT_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE').'">'; |
|
| 295 | + print '<img id="idRECRUITMENT_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE').'">'; |
|
| 296 | 296 | print '</div>'; |
| 297 | 297 | } |
| 298 | 298 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | if (preg_match('/^\((.*)\)$/', $conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) { |
| 307 | 307 | $text .= $langs->trans($reg[1])."<br>\n"; |
| 308 | 308 | } else { |
| 309 | - $text .= getDolGlobalString('RECRUITMENT_NEWFORM_TEXT') . "<br>\n"; |
|
| 309 | + $text .= getDolGlobalString('RECRUITMENT_NEWFORM_TEXT')."<br>\n"; |
|
| 310 | 310 | } |
| 311 | 311 | $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 312 | 312 | } |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $result = $userforfilter->fetch(0, $logini); |
| 519 | 519 | $sql .= " AND EXISTS (SELECT ec.rowid FROM ".MAIN_DB_PREFIX."element_contact as ec"; |
| 520 | 520 | $sql .= " WHERE ec.element_id = f.rowid"; |
| 521 | - $sql .= " AND ec.fk_c_type_contact = 26"; // FIXME do not use hardcoded ID |
|
| 521 | + $sql .= " AND ec.fk_c_type_contact = 26"; // FIXME do not use hardcoded ID |
|
| 522 | 522 | if ($result > 0) { |
| 523 | 523 | $sql .= " AND ec.fk_socpeople = ".((int) $userforfilter->id); |
| 524 | 524 | } elseif ($result < 0 || $condition == '=') { |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | $result = $userforfilter->fetch(0, $loginr); |
| 538 | 538 | $sql .= " AND EXISTS (SELECT ecr.rowid FROM ".MAIN_DB_PREFIX."element_contact as ecr"; |
| 539 | 539 | $sql .= " WHERE ecr.element_id = f.rowid"; |
| 540 | - $sql .= " WHERE AND ecr.fk_c_type_contact = 27"; // FIXME do not use hardcoded ID |
|
| 540 | + $sql .= " WHERE AND ecr.fk_c_type_contact = 27"; // FIXME do not use hardcoded ID |
|
| 541 | 541 | if ($result > 0) { |
| 542 | 542 | $sql .= " AND ecr.fk_socpeople = ".((int) $userforfilter->id); |
| 543 | 543 | } elseif ($result < 0 || $condition == '=') { |
@@ -593,9 +593,9 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | $duration = $obj->duree; |
| 595 | 595 | $event['location'] = ($obj->socname ? $obj->socname : ""); |
| 596 | - $event['summary'] = $obj->ref." - ". $obj->description; |
|
| 596 | + $event['summary'] = $obj->ref." - ".$obj->description; |
|
| 597 | 597 | if ($obj->ref_client) |
| 598 | - $event['summary'].= " (".$obj->ref_client.")"; |
|
| 598 | + $event['summary'] .= " (".$obj->ref_client.")"; |
|
| 599 | 599 | |
| 600 | 600 | $event['desc'] = $obj->description; |
| 601 | 601 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $event['desc'] .= " - ".$obj->ref_contract; |
| 607 | 607 | |
| 608 | 608 | if ($obj->note_public) |
| 609 | - $event['desc'].= " - ".$obj->note_public; |
|
| 609 | + $event['desc'] .= " - ".$obj->note_public; |
|
| 610 | 610 | |
| 611 | 611 | $event['startdate'] = $datestart; |
| 612 | 612 | $event['enddate'] = ''; // $dateend; // Not required with type 'journal' |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | $sql .= " AND ((tc.source = 'external'"; |
| 400 | 400 | $sql .= " AND tc.element = '".$db->escape($object->element)."'"; |
| 401 | 401 | $sql .= " AND tc.active = 1"; |
| 402 | - $sql .= " AND sp.email = '".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact |
|
| 403 | - $sql .= " OR s.email = '".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company |
|
| 404 | - $sql .= " OR t.origin_email = '".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester |
|
| 402 | + $sql .= " AND sp.email = '".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact |
|
| 403 | + $sql .= " OR s.email = '".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company |
|
| 404 | + $sql .= " OR t.origin_email = '".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester |
|
| 405 | 405 | // Manage filter |
| 406 | 406 | if (!empty($filter)) { |
| 407 | 407 | foreach ($filter as $key => $value) { |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | $baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); |
| 438 | 438 | |
| 439 | - $newcardbutton = '<a class="marginrightonly" href="'.$baseurl . 'create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany') ? '&entity='.$entity : '').'&token='.newToken().'" rel="nofollow noopener"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon" title="'.dol_escape_htmltag($langs->trans("CreateTicket")).'"></span></a>'; |
|
| 439 | + $newcardbutton = '<a class="marginrightonly" href="'.$baseurl.'create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany') ? '&entity='.$entity : '').'&token='.newToken().'" rel="nofollow noopener"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon" title="'.dol_escape_htmltag($langs->trans("CreateTicket")).'"></span></a>'; |
|
| 440 | 440 | |
| 441 | 441 | print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket', 0, $newcardbutton); |
| 442 | 442 | |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | // allow to display information before list |
| 455 | 455 | $parameters = array('arrayfields' => $arrayfields); |
| 456 | - $reshook = $hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 456 | + $reshook = $hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 457 | 457 | print $hookmanager->resPrint; |
| 458 | 458 | |
| 459 | 459 | print '<div class="div-table-responsive">'; |