|  | @@ -124,7 +124,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 124 | 124 |  		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { | 
                                                                                                            
                                                            | 125 | 125 |  			if (!empty($perm)) { | 
                                                                                                            
                                                            | 126 | 126 |  				$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 127 |  | -				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 127 | +				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 128 | 128 |  				if ($fieldrequired) { | 
                                                                                                            
                                                            | 129 | 129 |  					$ret .= '<span class="fieldrequired">'; | 
                                                                                                            
                                                            | 130 | 130 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -136,7 +136,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 136 | 136 |  				if ($fieldrequired) { | 
                                                                                                            
                                                            | 137 | 137 |  					$ret .= '</span>'; | 
                                                                                                            
                                                            | 138 | 138 |  				} | 
                                                                                                            
                                                            | 139 |  | -				$ret .= '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 139 | +				$ret .= '</div>'."\n"; | 
                                                                                                            
                                                            | 140 | 140 |  			} else { | 
                                                                                                            
                                                            | 141 | 141 |  				if ($fieldrequired) { | 
                                                                                                            
                                                            | 142 | 142 |  					$ret .= '<span class="fieldrequired">'; | 
                                                                                                                                                        
                                                        |  | @@ -174,8 +174,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 174 | 174 |  			if (empty($notabletag) && $perm) { | 
                                                                                                            
                                                            | 175 | 175 |  				$ret .= '<td class="right">'; | 
                                                                                                            
                                                            | 176 | 176 |  			} | 
                                                                                                            
                                                            | 177 |  | -			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { | 
                                                                                                            
                                                            | 178 |  | -				$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>'; | 
                                                                                                            
                                                            |  | 177 | +			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { | 
                                                                                                            
                                                            |  | 178 | +				$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>'; | 
                                                                                                            
                                                            | 179 | 179 |  			} | 
                                                                                                            
                                                            | 180 | 180 |  			if (!empty($notabletag) && $notabletag == 1) { | 
                                                                                                            
                                                            | 181 | 181 |  				if ($text) { | 
                                                                                                                                                        
                                                        |  | @@ -242,7 +242,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 242 | 242 |  			} elseif ($reg[1] == 'int') { | 
                                                                                                            
                                                            | 243 | 243 |  				$typeofdata = 'numeric'; | 
                                                                                                            
                                                            | 244 | 244 |  			} else { | 
                                                                                                            
                                                            | 245 |  | -				return 'ErrorBadParameter ' . $typeofdata; | 
                                                                                                            
                                                            |  | 245 | +				return 'ErrorBadParameter '.$typeofdata; | 
                                                                                                            
                                                            | 246 | 246 |  			} | 
                                                                                                            
                                                            | 247 | 247 |  		} | 
                                                                                                            
                                                            | 248 | 248 |   | 
                                                                                                                                                        
                                                        |  | @@ -253,13 +253,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 253 | 253 |  			if ($editaction == '') { | 
                                                                                                            
                                                            | 254 | 254 |  				$editaction = GETPOST('action', 'aZ09'); | 
                                                                                                            
                                                            | 255 | 255 |  			} | 
                                                                                                            
                                                            | 256 |  | -			$editmode = ($editaction == 'edit' . $htmlname); | 
                                                                                                            
                                                            |  | 256 | +			$editmode = ($editaction == 'edit'.$htmlname); | 
                                                                                                            
                                                            | 257 | 257 |  			if ($editmode) {	// edit mode | 
                                                                                                            
                                                            | 258 | 258 |  				$ret .= "<!-- formeditfieldval -->\n"; | 
                                                                                                            
                                                            | 259 |  | -				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">'; | 
                                                                                                            
                                                            | 260 |  | -				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; | 
                                                                                                            
                                                            | 261 |  | -				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            | 262 |  | -				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; | 
                                                                                                            
                                                            |  | 259 | +				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">'; | 
                                                                                                            
                                                            |  | 260 | +				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; | 
                                                                                                            
                                                            |  | 261 | +				$ret .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            |  | 262 | +				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; | 
                                                                                                            
                                                            | 263 | 263 |  				if (empty($notabletag)) { | 
                                                                                                            
                                                            | 264 | 264 |  					$ret .= '<table class="nobordernopadding centpercent">'; | 
                                                                                                            
                                                            | 265 | 265 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -268,28 +268,28 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 268 | 268 |  				} | 
                                                                                                            
                                                            | 269 | 269 |  				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { | 
                                                                                                            
                                                            | 270 | 270 |  					$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 271 |  | -					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; | 
                                                                                                            
                                                            |  | 271 | +					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; | 
                                                                                                            
                                                            | 272 | 272 |  				} elseif (preg_match('/^(integer)/', $typeofdata)) { | 
                                                                                                            
                                                            | 273 | 273 |  					$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 274 | 274 |  					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0); | 
                                                                                                            
                                                            | 275 |  | -					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; | 
                                                                                                            
                                                            |  | 275 | +					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; | 
                                                                                                            
                                                            | 276 | 276 |  				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { | 
                                                                                                            
                                                            | 277 | 277 |  					$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 278 | 278 |  					$valuetoshow = price2num($editvalue ? $editvalue : $value); | 
                                                                                                            
                                                            | 279 |  | -					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; | 
                                                                                                            
                                                            |  | 279 | +					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; | 
                                                                                                            
                                                            | 280 | 280 |  				} elseif (preg_match('/^(checkbox)/', $typeofdata)) { | 
                                                                                                            
                                                            | 281 | 281 |  					$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 282 |  | -					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>'; | 
                                                                                                            
                                                            |  | 282 | +					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>'; | 
                                                                                                            
                                                            | 283 | 283 |  				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor' | 
                                                                                                            
                                                            | 284 | 284 |  					$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 285 | 285 |  					$cols = (empty($tmp[2]) ? '' : $tmp[2]); | 
                                                                                                            
                                                            | 286 | 286 |  					$morealt = ''; | 
                                                                                                            
                                                            | 287 | 287 |  					if (preg_match('/%/', $cols)) { | 
                                                                                                            
                                                            | 288 |  | -						$morealt = ' style="width: ' . $cols . '"'; | 
                                                                                                            
                                                            |  | 288 | +						$morealt = ' style="width: '.$cols.'"'; | 
                                                                                                            
                                                            | 289 | 289 |  						$cols = ''; | 
                                                                                                            
                                                            | 290 | 290 |  					} | 
                                                                                                            
                                                            | 291 | 291 |  					$valuetoshow = ($editvalue ? $editvalue : $value); | 
                                                                                                            
                                                            | 292 |  | -					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>'; | 
                                                                                                            
                                                            |  | 292 | +					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>'; | 
                                                                                                            
                                                            | 293 | 293 |  					// textarea convert automatically entities chars into simple chars. | 
                                                                                                            
                                                            | 294 | 294 |  					// 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. | 
                                                                                                            
                                                            | 295 | 295 |  					$valuetoshow = str_replace('&', '&', $valuetoshow); | 
                                                                                                                                                        
                                                        |  | @@ -299,12 +299,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 299 | 299 |  					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; | 
                                                                                                            
                                                            | 300 | 300 |  					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; | 
                                                                                                            
                                                            | 301 | 301 |  					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; | 
                                                                                                            
                                                            | 302 |  | -					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); | 
                                                                                                            
                                                            |  | 302 | +					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); | 
                                                                                                            
                                                            | 303 | 303 |  				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                                                                            
                                                            | 304 | 304 |  					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; | 
                                                                                                            
                                                            | 305 | 305 |  					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; | 
                                                                                                            
                                                            | 306 | 306 |  					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; | 
                                                                                                            
                                                            | 307 |  | -					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); | 
                                                                                                            
                                                            |  | 307 | +					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); | 
                                                                                                            
                                                            | 308 | 308 |  				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                                                                            
                                                            | 309 | 309 |  					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                                                                            
                                                            | 310 | 310 |  					$arraylist = array(); | 
                                                                                                                                                        
                                                        |  | @@ -318,7 +318,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 318 | 318 |  					// TODO Not yet implemented. See code for extrafields | 
                                                                                                            
                                                            | 319 | 319 |  				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                                                                            
                                                            | 320 | 320 |  					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser | 
                                                                                                            
                                                            | 321 |  | -					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; | 
                                                                                                            
                                                            |  | 321 | +					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; | 
                                                                                                            
                                                            | 322 | 322 |  					$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])); | 
                                                                                                            
                                                            | 323 | 323 |  					$ret .= $doleditor->Create(1); | 
                                                                                                            
                                                            | 324 | 324 |  				} elseif ($typeofdata == 'asis') { | 
                                                                                                                                                        
                                                        |  | @@ -333,19 +333,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 333 | 333 |  					$ret .= '<td>'; | 
                                                                                                            
                                                            | 334 | 334 |  				} | 
                                                                                                            
                                                            | 335 | 335 |  				//else $ret.='<div class="clearboth"></div>'; | 
                                                                                                            
                                                            | 336 |  | -				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Save") . '">'; | 
                                                                                                            
                                                            |  | 336 | +				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Save").'">'; | 
                                                                                                            
                                                            | 337 | 337 |  				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { | 
                                                                                                            
                                                            | 338 |  | -					$ret .= '<br>' . "\n"; | 
                                                                                                            
                                                            |  | 338 | +					$ret .= '<br>'."\n"; | 
                                                                                                            
                                                            | 339 | 339 |  				} | 
                                                                                                            
                                                            | 340 |  | -				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; | 
                                                                                                            
                                                            |  | 340 | +				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                                                                            
                                                            | 341 | 341 |  				if (empty($notabletag)) { | 
                                                                                                            
                                                            | 342 | 342 |  					$ret .= '</td>'; | 
                                                                                                            
                                                            | 343 | 343 |  				} | 
                                                                                                            
                                                            | 344 | 344 |   | 
                                                                                                            
                                                            | 345 | 345 |  				if (empty($notabletag)) { | 
                                                                                                            
                                                            | 346 |  | -					$ret .= '</tr></table>' . "\n"; | 
                                                                                                            
                                                            |  | 346 | +					$ret .= '</tr></table>'."\n"; | 
                                                                                                            
                                                            | 347 | 347 |  				} | 
                                                                                                            
                                                            | 348 |  | -				$ret .= '</form>' . "\n"; | 
                                                                                                            
                                                            |  | 348 | +				$ret .= '</form>'."\n"; | 
                                                                                                            
                                                            | 349 | 349 |  			} else {		// view mode | 
                                                                                                            
                                                            | 350 | 350 |  				if (preg_match('/^email/', $typeofdata)) { | 
                                                                                                            
                                                            | 351 | 351 |  					$ret .= dol_print_email($value, 0, 0, 0, 0, 1); | 
                                                                                                                                                        
                                                        |  | @@ -357,15 +357,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 357 | 357 |  					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : ''); | 
                                                                                                            
                                                            | 358 | 358 |  				} elseif (preg_match('/^checkbox/', $typeofdata)) { | 
                                                                                                            
                                                            | 359 | 359 |  					$tmp = explode(':', $typeofdata); | 
                                                                                                            
                                                            | 360 |  | -					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>'; | 
                                                                                                            
                                                            |  | 360 | +					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>'; | 
                                                                                                            
                                                            | 361 | 361 |  				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { | 
                                                                                                            
                                                            | 362 | 362 |  					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1)); | 
                                                                                                            
                                                            | 363 | 363 |  				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' | 
                                                                                                            
                                                            | 364 | 364 |  					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value)); | 
                                                                                                            
                                                            | 365 | 365 |  				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { | 
                                                                                                            
                                                            | 366 |  | -					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>'; | 
                                                                                                            
                                                            |  | 366 | +					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>'; | 
                                                                                                            
                                                            | 367 | 367 |  				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                                                                            
                                                            | 368 |  | -					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>'; | 
                                                                                                            
                                                            |  | 368 | +					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>'; | 
                                                                                                            
                                                            | 369 | 369 |  				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                                                                            
                                                            | 370 | 370 |  					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                                                                            
                                                            | 371 | 371 |  					$arraylist = array(); | 
                                                                                                                                                        
                                                        |  | @@ -376,9 +376,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 376 | 376 |  					$ret .= $arraylist[$value]; | 
                                                                                                            
                                                            | 377 | 377 |  					if ($htmlname == 'fk_product_type') { | 
                                                                                                            
                                                            | 378 | 378 |  						if ($value == 0) { | 
                                                                                                            
                                                            | 379 |  | -							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                                                                            
                                                            |  | 379 | +							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                                                                            
                                                            | 380 | 380 |  						} else { | 
                                                                                                            
                                                            | 381 |  | -							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                                                                            
                                                            |  | 381 | +							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                                                                            
                                                            | 382 | 382 |  						} | 
                                                                                                            
                                                            | 383 | 383 |  					} | 
                                                                                                            
                                                            | 384 | 384 |  				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                                                                                                                        
                                                        |  | @@ -386,7 +386,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 386 | 386 |  					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { | 
                                                                                                            
                                                            | 387 | 387 |  						$firstline = preg_replace('/<br>.*/', '', $tmpcontent); | 
                                                                                                            
                                                            | 388 | 388 |  						$firstline = preg_replace('/[\n\r].*/', '', $firstline); | 
                                                                                                            
                                                            | 389 |  | -						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); | 
                                                                                                            
                                                            |  | 389 | +						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); | 
                                                                                                            
                                                            | 390 | 390 |  					} | 
                                                                                                            
                                                            | 391 | 391 |  					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also | 
                                                                                                            
                                                            | 392 | 392 |  					// clean data from some dangerous html | 
                                                                                                                                                        
                                                        |  | @@ -395,7 +395,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 395 | 395 |  					if (empty($moreoptions['valuealreadyhtmlescaped'])) { | 
                                                                                                            
                                                            | 396 | 396 |  						$ret .= dol_escape_htmltag($value); | 
                                                                                                            
                                                            | 397 | 397 |  					} else { | 
                                                                                                            
                                                            | 398 |  | -						$ret .= $value;        // $value must be already html escaped. | 
                                                                                                            
                                                            |  | 398 | +						$ret .= $value; // $value must be already html escaped. | 
                                                                                                            
                                                            | 399 | 399 |  					} | 
                                                                                                            
                                                            | 400 | 400 |  				} | 
                                                                                                            
                                                            | 401 | 401 |   | 
                                                                                                                                                        
                                                        |  | @@ -433,7 +433,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 433 | 433 |   | 
                                                                                                            
                                                            | 434 | 434 |  		if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                                                                            
                                                            | 435 | 435 |  			if (!is_object($extralanguages)) { | 
                                                                                                            
                                                            | 436 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; | 
                                                                                                            
                                                            |  | 436 | +				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; | 
                                                                                                            
                                                            | 437 | 437 |  				$extralanguages = new ExtraLanguages($this->db); | 
                                                                                                            
                                                            | 438 | 438 |  			} | 
                                                                                                            
                                                            | 439 | 439 |  			$extralanguages->fetch_name_extralanguages('societe'); | 
                                                                                                                                                        
                                                        |  | @@ -442,17 +442,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 442 | 442 |  				return ''; // No extralang field to show | 
                                                                                                            
                                                            | 443 | 443 |  			} | 
                                                                                                            
                                                            | 444 | 444 |   | 
                                                                                                            
                                                            | 445 |  | -			$result .= '<!-- Widget for translation -->' . "\n"; | 
                                                                                                            
                                                            | 446 |  | -			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">'; | 
                                                                                                            
                                                            |  | 445 | +			$result .= '<!-- Widget for translation -->'."\n"; | 
                                                                                                            
                                                            |  | 446 | +			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">'; | 
                                                                                                            
                                                            | 447 | 447 |  			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', 0, 0, 0, '', 'fa-15 editfieldlang'); | 
                                                                                                            
                                                            | 448 | 448 |  			$result .= $s; | 
                                                                                                            
                                                            | 449 | 449 |  			$result .= '</div>'; | 
                                                                                                            
                                                            | 450 | 450 |   | 
                                                                                                            
                                                            | 451 |  | -			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">'; | 
                                                                                                            
                                                            |  | 451 | +			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">'; | 
                                                                                                            
                                                            | 452 | 452 |   | 
                                                                                                            
                                                            | 453 | 453 |  			$resultforextrlang = ''; | 
                                                                                                            
                                                            | 454 | 454 |  			foreach ($arrayoflangcode as $langcode) { | 
                                                                                                            
                                                            | 455 |  | -				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; | 
                                                                                                            
                                                            |  | 455 | +				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; | 
                                                                                                            
                                                            | 456 | 456 |  				if (empty($valuetoshow)) { | 
                                                                                                            
                                                            | 457 | 457 |  					$object->fetchValuesForExtraLanguages(); | 
                                                                                                            
                                                            | 458 | 458 |  					//var_dump($object->array_languages); | 
                                                                                                                                                        
                                                        |  | @@ -464,17 +464,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 464 | 464 |   | 
                                                                                                            
                                                            | 465 | 465 |  				// TODO Use the showInputField() method of ExtraLanguages object | 
                                                                                                            
                                                            | 466 | 466 |  				if ($typeofdata == 'textarea') { | 
                                                                                                            
                                                            | 467 |  | -					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">'; | 
                                                                                                            
                                                            |  | 467 | +					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">'; | 
                                                                                                            
                                                            | 468 | 468 |  					$resultforextrlang .= $valuetoshow; | 
                                                                                                            
                                                            | 469 | 469 |  					$resultforextrlang .= '</textarea>'; | 
                                                                                                            
                                                            | 470 | 470 |  				} else { | 
                                                                                                            
                                                            | 471 |  | -					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">'; | 
                                                                                                            
                                                            |  | 471 | +					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">'; | 
                                                                                                            
                                                            | 472 | 472 |  				} | 
                                                                                                            
                                                            | 473 | 473 |  			} | 
                                                                                                            
                                                            | 474 | 474 |  			$result .= $resultforextrlang; | 
                                                                                                            
                                                            | 475 | 475 |   | 
                                                                                                            
                                                            | 476 | 476 |  			$result .= '</div>'; | 
                                                                                                            
                                                            | 477 |  | -			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; | 
                                                                                                            
                                                            |  | 477 | +			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; | 
                                                                                                            
                                                            | 478 | 478 |  		} | 
                                                                                                            
                                                            | 479 | 479 |   | 
                                                                                                            
                                                            | 480 | 480 |  		return $result; | 
                                                                                                                                                        
                                                        |  | @@ -537,7 +537,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 537 | 537 |  				if (!empty($tmp[2])) { | 
                                                                                                            
                                                            | 538 | 538 |  					$savemethod = $tmp[2]; | 
                                                                                                            
                                                            | 539 | 539 |  				} | 
                                                                                                            
                                                            | 540 |  | -				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 540 | +				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 541 | 541 |  			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { | 
                                                                                                            
                                                            | 542 | 542 |  				$tmp = explode(':', $inputType); | 
                                                                                                            
                                                            | 543 | 543 |  				$inputType = $tmp[0]; | 
                                                                                                                                                        
                                                        |  | @@ -548,7 +548,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 548 | 548 |  					$savemethod = $tmp[2]; | 
                                                                                                            
                                                            | 549 | 549 |  				} | 
                                                                                                            
                                                            | 550 | 550 |   | 
                                                                                                            
                                                            | 551 |  | -				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format | 
                                                                                                            
                                                            |  | 551 | +				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format | 
                                                                                                            
                                                            | 552 | 552 |  			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { | 
                                                                                                            
                                                            | 553 | 553 |  				$tmp = explode(':', $inputType); | 
                                                                                                            
                                                            | 554 | 554 |  				$inputType = $tmp[0]; | 
                                                                                                                                                        
                                                        |  | @@ -579,40 +579,40 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 579 | 579 |  				} | 
                                                                                                            
                                                            | 580 | 580 |   | 
                                                                                                            
                                                            | 581 | 581 |  				if (isModEnabled('fckeditor')) { | 
                                                                                                            
                                                            | 582 |  | -					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 582 | +					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 583 | 583 |  				} else { | 
                                                                                                            
                                                            | 584 | 584 |  					$inputType = 'textarea'; | 
                                                                                                            
                                                            | 585 | 585 |  				} | 
                                                                                                            
                                                            | 586 | 586 |  			} | 
                                                                                                            
                                                            | 587 | 587 |   | 
                                                                                                            
                                                            | 588 |  | -			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            | 589 |  | -			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            | 590 |  | -			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            | 591 |  | -			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 588 | +			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            |  | 589 | +			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            |  | 590 | +			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            |  | 591 | +			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 592 | 592 |  			if (!empty($savemethod)) { | 
                                                                                                            
                                                            | 593 |  | -				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 593 | +				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 594 | 594 |  			} | 
                                                                                                            
                                                            | 595 | 595 |  			if (!empty($ext_element)) { | 
                                                                                                            
                                                            | 596 |  | -				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 596 | +				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 597 | 597 |  			} | 
                                                                                                            
                                                            | 598 | 598 |  			if (!empty($custommsg)) { | 
                                                                                                            
                                                            | 599 | 599 |  				if (is_array($custommsg)) { | 
                                                                                                            
                                                            | 600 | 600 |  					if (!empty($custommsg['success'])) { | 
                                                                                                            
                                                            | 601 |  | -						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 601 | +						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 602 | 602 |  					} | 
                                                                                                            
                                                            | 603 | 603 |  					if (!empty($custommsg['error'])) { | 
                                                                                                            
                                                            | 604 |  | -						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 604 | +						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 605 | 605 |  					} | 
                                                                                                            
                                                            | 606 | 606 |  				} else { | 
                                                                                                            
                                                            | 607 |  | -					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 607 | +					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 608 | 608 |  				} | 
                                                                                                            
                                                            | 609 | 609 |  			} | 
                                                                                                            
                                                            | 610 | 610 |  			if ($inputType == 'textarea') { | 
                                                                                                            
                                                            | 611 |  | -				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            | 612 |  | -				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n"; | 
                                                                                                            
                                                            |  | 611 | +				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            |  | 612 | +				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n"; | 
                                                                                                            
                                                            | 613 | 613 |  			} | 
                                                                                                            
                                                            | 614 |  | -			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n"; | 
                                                                                                            
                                                            | 615 |  | -			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n"; | 
                                                                                                            
                                                            |  | 614 | +			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; | 
                                                                                                            
                                                            |  | 615 | +			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n"; | 
                                                                                                            
                                                            | 616 | 616 |  		} else { | 
                                                                                                            
                                                            | 617 | 617 |  			$out = $value; | 
                                                                                                            
                                                            | 618 | 618 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -641,12 +641,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 641 | 641 |  	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) | 
                                                                                                            
                                                            | 642 | 642 |  	{ | 
                                                                                                            
                                                            | 643 | 643 |  		if ($incbefore) { | 
                                                                                                            
                                                            | 644 |  | -			$text = $incbefore . $text; | 
                                                                                                            
                                                            |  | 644 | +			$text = $incbefore.$text; | 
                                                                                                            
                                                            | 645 | 645 |  		} | 
                                                                                                            
                                                            | 646 | 646 |  		if (!$htmltext) { | 
                                                                                                            
                                                            | 647 | 647 |  			return $text; | 
                                                                                                            
                                                            | 648 | 648 |  		} | 
                                                                                                            
                                                            | 649 |  | -		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0 | 
                                                                                                            
                                                            |  | 649 | +		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 | 
                                                                                                            
                                                            | 650 | 650 |   | 
                                                                                                            
                                                            | 651 | 651 |  		$tag = 'td'; | 
                                                                                                            
                                                            | 652 | 652 |  		if ($notabs == 2) { | 
                                                                                                                                                        
                                                        |  | @@ -660,11 +660,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 660 | 660 |   | 
                                                                                                            
                                                            | 661 | 661 |  		$extrastyle = ''; | 
                                                                                                            
                                                            | 662 | 662 |  		if ($direction < 0) { | 
                                                                                                            
                                                            | 663 |  | -			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : ''); | 
                                                                                                            
                                                            |  | 663 | +			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : ''); | 
                                                                                                            
                                                            | 664 | 664 |  			$extrastyle = 'padding: 0px; padding-left: 2px;'; | 
                                                                                                            
                                                            | 665 | 665 |  		} | 
                                                                                                            
                                                            | 666 | 666 |  		if ($direction > 0) { | 
                                                                                                            
                                                            | 667 |  | -			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : ''); | 
                                                                                                            
                                                            |  | 667 | +			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : ''); | 
                                                                                                            
                                                            | 668 | 668 |  			$extrastyle = 'padding: 0px; padding-right: 2px;'; | 
                                                                                                            
                                                            | 669 | 669 |  		} | 
                                                                                                            
                                                            | 670 | 670 |   | 
                                                                                                                                                        
                                                        |  | @@ -677,53 +677,53 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 677 | 677 |  			$htmltext = str_replace('"', '"', $htmltext); | 
                                                                                                            
                                                            | 678 | 678 |  		} else { | 
                                                                                                            
                                                            | 679 | 679 |  			$classfortooltip = 'classfortooltiponclick'; | 
                                                                                                            
                                                            | 680 |  | -			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; | 
                                                                                                            
                                                            |  | 680 | +			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; | 
                                                                                                            
                                                            | 681 | 681 |  		} | 
                                                                                                            
                                                            | 682 | 682 |  		if ($tooltipon == 2 || $tooltipon == 3) { | 
                                                                                                            
                                                            | 683 |  | -			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; | 
                                                                                                            
                                                            |  | 683 | +			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; | 
                                                                                                            
                                                            | 684 | 684 |  			if ($tooltiptrigger == '') { | 
                                                                                                            
                                                            | 685 |  | -				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip | 
                                                                                                            
                                                            |  | 685 | +				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip | 
                                                                                                            
                                                            | 686 | 686 |  			} else { | 
                                                                                                            
                                                            | 687 |  | -				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; | 
                                                                                                            
                                                            |  | 687 | +				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; | 
                                                                                                            
                                                            | 688 | 688 |  			} | 
                                                                                                            
                                                            | 689 | 689 |  		} else { | 
                                                                                                            
                                                            | 690 |  | -			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag | 
                                                                                                            
                                                            |  | 690 | +			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag | 
                                                                                                            
                                                            | 691 | 691 |  		} | 
                                                                                                            
                                                            | 692 | 692 |  		if ($tooltipon == 1 || $tooltipon == 3) { | 
                                                                                                            
                                                            | 693 |  | -			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ($tag != 'td' ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; | 
                                                                                                            
                                                            |  | 693 | +			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.($tag != 'td' ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; | 
                                                                                                            
                                                            | 694 | 694 |  			if ($tooltiptrigger == '') { | 
                                                                                                            
                                                            | 695 |  | -				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip | 
                                                                                                            
                                                            |  | 695 | +				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip | 
                                                                                                            
                                                            | 696 | 696 |  			} else { | 
                                                                                                            
                                                            | 697 |  | -				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; | 
                                                                                                            
                                                            |  | 697 | +				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; | 
                                                                                                            
                                                            | 698 | 698 |  			} | 
                                                                                                            
                                                            | 699 | 699 |  		} else { | 
                                                                                                            
                                                            | 700 |  | -			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag | 
                                                                                                            
                                                            |  | 700 | +			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag | 
                                                                                                            
                                                            | 701 | 701 |  		} | 
                                                                                                            
                                                            | 702 | 702 |  		if (empty($notabs)) { | 
                                                                                                            
                                                            | 703 | 703 |  			$s .= '<table class="nobordernopadding"><tr style="height: auto;">'; | 
                                                                                                            
                                                            | 704 | 704 |  		} elseif ($notabs == 2) { | 
                                                                                                            
                                                            | 705 |  | -			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; | 
                                                                                                            
                                                            |  | 705 | +			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; | 
                                                                                                            
                                                            | 706 | 706 |  		} | 
                                                                                                            
                                                            | 707 | 707 |  		// Define value if value is before | 
                                                                                                            
                                                            | 708 | 708 |  		if ($direction < 0) { | 
                                                                                                            
                                                            | 709 |  | -			$s .= '<' . $tag . $paramfortooltipimg; | 
                                                                                                            
                                                            |  | 709 | +			$s .= '<'.$tag.$paramfortooltipimg; | 
                                                                                                            
                                                            | 710 | 710 |  			if ($tag == 'td') { | 
                                                                                                            
                                                            | 711 | 711 |  				$s .= ' class="valigntop" width="14"'; | 
                                                                                                            
                                                            | 712 | 712 |  			} | 
                                                                                                            
                                                            | 713 |  | -			$s .= '>' . $textfordialog . $img . '</' . $tag . '>'; | 
                                                                                                            
                                                            |  | 713 | +			$s .= '>'.$textfordialog.$img.'</'.$tag.'>'; | 
                                                                                                            
                                                            | 714 | 714 |  		} | 
                                                                                                            
                                                            | 715 | 715 |  		// Use another method to help avoid having a space in value in order to use this value with jquery | 
                                                                                                            
                                                            | 716 | 716 |  		// Define label | 
                                                                                                            
                                                            | 717 | 717 |  		if ((string) $text != '') { | 
                                                                                                            
                                                            | 718 |  | -			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; | 
                                                                                                            
                                                            |  | 718 | +			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; | 
                                                                                                            
                                                            | 719 | 719 |  		} | 
                                                                                                            
                                                            | 720 | 720 |  		// Define value if value is after | 
                                                                                                            
                                                            | 721 | 721 |  		if ($direction > 0) { | 
                                                                                                            
                                                            | 722 |  | -			$s .= '<' . $tag . $paramfortooltipimg; | 
                                                                                                            
                                                            |  | 722 | +			$s .= '<'.$tag.$paramfortooltipimg; | 
                                                                                                            
                                                            | 723 | 723 |  			if ($tag == 'td') { | 
                                                                                                            
                                                            | 724 | 724 |  				$s .= ' class="valignmiddle" width="14"'; | 
                                                                                                            
                                                            | 725 | 725 |  			} | 
                                                                                                            
                                                            | 726 |  | -			$s .= '>' . $textfordialog . $img . '</' . $tag . '>'; | 
                                                                                                            
                                                            |  | 726 | +			$s .= '>'.$textfordialog.$img.'</'.$tag.'>'; | 
                                                                                                            
                                                            | 727 | 727 |  		} | 
                                                                                                            
                                                            | 728 | 728 |  		if (empty($notabs)) { | 
                                                                                                            
                                                            | 729 | 729 |  			$s .= '</tr></table>'; | 
                                                                                                                                                        
                                                        |  | @@ -830,7 +830,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 830 | 830 |   | 
                                                                                                            
                                                            | 831 | 831 |  		$disabled = 0; | 
                                                                                                            
                                                            | 832 | 832 |  		$ret = '<div class="centpercent center">'; | 
                                                                                                            
                                                            | 833 |  | -		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>'; | 
                                                                                                            
                                                            |  | 833 | +		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>'; | 
                                                                                                            
                                                            | 834 | 834 |   | 
                                                                                                            
                                                            | 835 | 835 |  		// 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. | 
                                                                                                            
                                                            | 836 | 836 |  		$parameters = array(); | 
                                                                                                                                                        
                                                        |  | @@ -841,10 +841,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 841 | 841 |  			return; | 
                                                                                                            
                                                            | 842 | 842 |  		} | 
                                                                                                            
                                                            | 843 | 843 |  		if (empty($reshook)) { | 
                                                                                                            
                                                            | 844 |  | -			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; | 
                                                                                                            
                                                            |  | 844 | +			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; | 
                                                                                                            
                                                            | 845 | 845 |  			if (is_array($arrayofaction)) { | 
                                                                                                            
                                                            | 846 | 846 |  				foreach ($arrayofaction as $code => $label) { | 
                                                                                                            
                                                            | 847 |  | -					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>'; | 
                                                                                                            
                                                            |  | 847 | +					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>'; | 
                                                                                                            
                                                            | 848 | 848 |  				} | 
                                                                                                            
                                                            | 849 | 849 |  			} | 
                                                                                                            
                                                            | 850 | 850 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -853,17 +853,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 853 | 853 |  		$ret .= '</select>'; | 
                                                                                                            
                                                            | 854 | 854 |   | 
                                                                                                            
                                                            | 855 | 855 |  		if (empty($conf->dol_optimize_smallscreen)) { | 
                                                                                                            
                                                            | 856 |  | -			$ret .= ajax_combobox('.' . $name . 'select'); | 
                                                                                                            
                                                            |  | 856 | +			$ret .= ajax_combobox('.'.$name.'select'); | 
                                                                                                            
                                                            | 857 | 857 |  		} | 
                                                                                                            
                                                            | 858 | 858 |   | 
                                                                                                            
                                                            | 859 | 859 |  		// 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 | 
                                                                                                            
                                                            | 860 | 860 |  		$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. | 
                                                                                                            
                                                            | 861 |  | -		$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 | +		$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")).'">'; | 
                                                                                                            
                                                            | 862 | 862 |  		$ret .= '</div>'; | 
                                                                                                            
                                                            | 863 | 863 |   | 
                                                                                                            
                                                            | 864 | 864 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 865 | 865 |  			$ret .= '<!-- JS CODE TO ENABLE mass action select --> | 
                                                                                                            
                                                            | 866 |  | -    		<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 866 | +    		<script nonce="' . getNonce().'"> | 
                                                                                                            
                                                            | 867 | 867 |                          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 */ | 
                                                                                                            
                                                            | 868 | 868 |          		{ | 
                                                                                                            
                                                            | 869 | 869 |          			atleastoneselected=0; | 
                                                                                                                                                        
                                                        |  | @@ -874,11 +874,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 874 | 874 |   | 
                                                                                                            
                                                            | 875 | 875 |  					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); | 
                                                                                                            
                                                            | 876 | 876 |   | 
                                                                                                            
                                                            | 877 |  | -    	  			if (atleastoneselected || ' . $alwaysvisible . ') | 
                                                                                                            
                                                            |  | 877 | +    	  			if (atleastoneselected || ' . $alwaysvisible.') | 
                                                                                                            
                                                            | 878 | 878 |      	  			{ | 
                                                                                                            
                                                            | 879 | 879 |                                      jQuery("."+name).show(); | 
                                                                                                            
                                                            | 880 |  | -        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' | 
                                                                                                            
                                                            | 881 |  | -        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' | 
                                                                                                            
                                                            |  | 880 | +        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' | 
                                                                                                            
                                                            |  | 881 | +        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' | 
                                                                                                            
                                                            | 882 | 882 |      	  			} | 
                                                                                                            
                                                            | 883 | 883 |      	  			else | 
                                                                                                            
                                                            | 884 | 884 |      	  			{ | 
                                                                                                                                                        
                                                        |  | @@ -888,26 +888,26 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 888 | 888 |          		} | 
                                                                                                            
                                                            | 889 | 889 |   | 
                                                                                                            
                                                            | 890 | 890 |          	jQuery(document).ready(function () { | 
                                                                                                            
                                                            | 891 |  | -                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '"); | 
                                                                                                            
                                                            | 892 |  | -                    jQuery(".' . $cssclass . '").click(function() { | 
                                                                                                            
                                                            | 893 |  | -                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '"); | 
                                                                                                            
                                                            |  | 891 | +                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'"); | 
                                                                                                            
                                                            |  | 892 | +                    jQuery(".' . $cssclass.'").click(function() { | 
                                                                                                            
                                                            |  | 893 | +                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'"); | 
                                                                                                            
                                                            | 894 | 894 |                      }); | 
                                                                                                            
                                                            | 895 |  | -                    jQuery(".' . $name . 'select").change(function() { | 
                                                                                                            
                                                            |  | 895 | +                    jQuery(".' . $name.'select").change(function() { | 
                                                                                                            
                                                            | 896 | 896 |          				var massaction = $( this ).val(); | 
                                                                                                            
                                                            | 897 | 897 |          				var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); | 
                                                                                                            
                                                            | 898 | 898 |          				if (massaction == "builddoc") { | 
                                                                                                            
                                                            | 899 | 899 |                          	urlform = urlform + "#show_files"; | 
                                                                                                            
                                                            | 900 | 900 |      	            	} | 
                                                                                                            
                                                            | 901 | 901 |          				$( this ).closest("form").attr("action", urlform); | 
                                                                                                            
                                                            | 902 |  | -                    	console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); | 
                                                                                                            
                                                            |  | 902 | +                    	console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); | 
                                                                                                            
                                                            | 903 | 903 |          	        	/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ | 
                                                                                                            
                                                            | 904 | 904 |          				if ($(this).val() != \'0\') { | 
                                                                                                            
                                                            | 905 |  | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); | 
                                                                                                            
                                                            | 906 |  | -										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */ | 
                                                                                                            
                                                            | 907 |  | -                                        jQuery(".' . $name . '"+massaction).show(); | 
                                                                                                            
                                                            |  | 905 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false); | 
                                                                                                            
                                                            |  | 906 | +										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */ | 
                                                                                                            
                                                            |  | 907 | +                                        jQuery(".' . $name.'"+massaction).show(); | 
                                                                                                            
                                                            | 908 | 908 |      	  				} else { | 
                                                                                                            
                                                            | 909 |  | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); | 
                                                                                                            
                                                            | 910 |  | -										jQuery(".' . $name . 'other").hide();	/* To disable any div open */ | 
                                                                                                            
                                                            |  | 909 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true); | 
                                                                                                            
                                                            |  | 910 | +										jQuery(".' . $name.'other").hide();	/* To disable any div open */ | 
                                                                                                            
                                                            | 911 | 911 |      	  				} | 
                                                                                                            
                                                            | 912 | 912 |      	        }); | 
                                                                                                            
                                                            | 913 | 913 |          	}); | 
                                                                                                                                                        
                                                        |  | @@ -951,14 +951,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 951 | 951 |  		$atleastonefavorite = 0; | 
                                                                                                            
                                                            | 952 | 952 |   | 
                                                                                                            
                                                            | 953 | 953 |  		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; | 
                                                                                                            
                                                            | 954 |  | -		$sql .= " FROM " . $this->db->prefix() . "c_country"; | 
                                                                                                            
                                                            |  | 954 | +		$sql .= " FROM ".$this->db->prefix()."c_country"; | 
                                                                                                            
                                                            | 955 | 955 |  		$sql .= " WHERE active > 0"; | 
                                                                                                            
                                                            | 956 | 956 |  		//$sql.= " ORDER BY code ASC"; | 
                                                                                                            
                                                            | 957 | 957 |   | 
                                                                                                            
                                                            | 958 |  | -		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 958 | +		dol_syslog(get_class($this)."::select_country", LOG_DEBUG); | 
                                                                                                            
                                                            | 959 | 959 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 960 | 960 |  		if ($resql) { | 
                                                                                                            
                                                            | 961 |  | -			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; | 
                                                                                                            
                                                            |  | 961 | +			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; | 
                                                                                                            
                                                            | 962 | 962 |  			$num = $this->db->num_rows($resql); | 
                                                                                                            
                                                            | 963 | 963 |  			$i = 0; | 
                                                                                                            
                                                            | 964 | 964 |  			if ($num) { | 
                                                                                                                                                        
                                                        |  | @@ -968,7 +968,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 968 | 968 |  					$countryArray[$i]['rowid'] = $obj->rowid; | 
                                                                                                            
                                                            | 969 | 969 |  					$countryArray[$i]['code_iso'] = $obj->code_iso; | 
                                                                                                            
                                                            | 970 | 970 |  					$countryArray[$i]['code_iso3'] = $obj->code_iso3; | 
                                                                                                            
                                                            | 971 |  | -					$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 : '')); | 
                                                                                                            
                                                            |  | 971 | +					$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 : '')); | 
                                                                                                            
                                                            | 972 | 972 |  					$countryArray[$i]['favorite'] = $obj->favorite; | 
                                                                                                            
                                                            | 973 | 973 |  					$countryArray[$i]['eec'] = $obj->eec; | 
                                                                                                            
                                                            | 974 | 974 |  					$favorite[$i] = $obj->favorite; | 
                                                                                                                                                        
                                                        |  | @@ -986,20 +986,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 986 | 986 |   | 
                                                                                                            
                                                            | 987 | 987 |  				if ($showempty) { | 
                                                                                                            
                                                            | 988 | 988 |  					if (is_numeric($showempty)) { | 
                                                                                                            
                                                            | 989 |  | -						$out .= '<option value=""> </option>' . "\n"; | 
                                                                                                            
                                                            |  | 989 | +						$out .= '<option value=""> </option>'."\n"; | 
                                                                                                            
                                                            | 990 | 990 |  					} else { | 
                                                                                                            
                                                            | 991 |  | -						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 991 | +						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; | 
                                                                                                            
                                                            | 992 | 992 |  					} | 
                                                                                                            
                                                            | 993 | 993 |  				} | 
                                                                                                            
                                                            | 994 | 994 |   | 
                                                                                                            
                                                            | 995 | 995 |  				if ($addspecialentries) {    // Add dedicated entries for groups of countries | 
                                                                                                            
                                                            | 996 | 996 |  					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; | 
                                                                                                            
                                                            | 997 |  | -					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                                                                            
                                                            | 998 |  | -					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; | 
                                                                                                            
                                                            |  | 997 | +					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                                                                            
                                                            |  | 998 | +					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; | 
                                                                                                            
                                                            | 999 | 999 |  					if ($mysoc->isInEEC()) { | 
                                                                                                            
                                                            | 1000 |  | -						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                                                                            
                                                            |  | 1000 | +						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                                                                            
                                                            | 1001 | 1001 |  					} | 
                                                                                                            
                                                            | 1002 |  | -					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; | 
                                                                                                            
                                                            |  | 1002 | +					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; | 
                                                                                                            
                                                            | 1003 | 1003 |  					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; | 
                                                                                                            
                                                            | 1004 | 1004 |  				} | 
                                                                                                            
                                                            | 1005 | 1005 |   | 
                                                                                                                                                        
                                                        |  | @@ -1027,20 +1027,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1027 | 1027 |  						$labeltoshow .= ' '; | 
                                                                                                            
                                                            | 1028 | 1028 |  					} | 
                                                                                                            
                                                            | 1029 | 1029 |  					if ($row['code_iso']) { | 
                                                                                                            
                                                            | 1030 |  | -						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; | 
                                                                                                            
                                                            |  | 1030 | +						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; | 
                                                                                                            
                                                            | 1031 | 1031 |  						if (empty($hideflags)) { | 
                                                                                                            
                                                            | 1032 | 1032 |  							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); | 
                                                                                                            
                                                            | 1033 |  | -							$labeltoshow = $tmpflag . ' ' . $labeltoshow; | 
                                                                                                            
                                                            |  | 1033 | +							$labeltoshow = $tmpflag.' '.$labeltoshow; | 
                                                                                                            
                                                            | 1034 | 1034 |  						} | 
                                                                                                            
                                                            | 1035 | 1035 |  					} | 
                                                                                                            
                                                            | 1036 | 1036 |   | 
                                                                                                            
                                                            | 1037 | 1037 |  					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { | 
                                                                                                            
                                                            | 1038 |  | -						$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']) . '">'; | 
                                                                                                            
                                                            |  | 1038 | +						$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']).'">'; | 
                                                                                                            
                                                            | 1039 | 1039 |  					} else { | 
                                                                                                            
                                                            | 1040 |  | -						$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']) . '">'; | 
                                                                                                            
                                                            |  | 1040 | +						$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']).'">'; | 
                                                                                                            
                                                            | 1041 | 1041 |  					} | 
                                                                                                            
                                                            | 1042 | 1042 |  					$out .= dol_string_nohtmltag($labeltoshow); | 
                                                                                                            
                                                            | 1043 |  | -					$out .= '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 1043 | +					$out .= '</option>'."\n"; | 
                                                                                                            
                                                            | 1044 | 1044 |  				} | 
                                                                                                            
                                                            | 1045 | 1045 |  			} | 
                                                                                                            
                                                            | 1046 | 1046 |  			$out .= '</select>'; | 
                                                                                                                                                        
                                                        |  | @@ -1050,8 +1050,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1050 | 1050 |   | 
                                                                                                            
                                                            | 1051 | 1051 |  		// Make select dynamic | 
                                                                                                            
                                                            | 1052 | 1052 |  		if (empty($forcecombo)) { | 
                                                                                                            
                                                            | 1053 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 1054 |  | -			$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); | 
                                                                                                            
                                                            |  | 1053 | +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 1054 | +			$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); | 
                                                                                                            
                                                            | 1055 | 1055 |  		} | 
                                                                                                            
                                                            | 1056 | 1056 |   | 
                                                                                                            
                                                            | 1057 | 1057 |  		return $out; | 
                                                                                                                                                        
                                                        |  | @@ -1084,25 +1084,25 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1084 | 1084 |  		$incotermArray = array(); | 
                                                                                                            
                                                            | 1085 | 1085 |   | 
                                                                                                            
                                                            | 1086 | 1086 |  		$sql = "SELECT rowid, code"; | 
                                                                                                            
                                                            | 1087 |  | -		$sql .= " FROM " . $this->db->prefix() . "c_incoterms"; | 
                                                                                                            
                                                            |  | 1087 | +		$sql .= " FROM ".$this->db->prefix()."c_incoterms"; | 
                                                                                                            
                                                            | 1088 | 1088 |  		$sql .= " WHERE active > 0"; | 
                                                                                                            
                                                            | 1089 | 1089 |  		$sql .= " ORDER BY code ASC"; | 
                                                                                                            
                                                            | 1090 | 1090 |   | 
                                                                                                            
                                                            | 1091 |  | -		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 1091 | +		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); | 
                                                                                                            
                                                            | 1092 | 1092 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 1093 | 1093 |  		if ($resql) { | 
                                                                                                            
                                                            | 1094 | 1094 |  			if ($conf->use_javascript_ajax && !$forcecombo) { | 
                                                                                                            
                                                            | 1095 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 1095 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 1096 | 1096 |  				$out .= ajax_combobox($htmlname, $events); | 
                                                                                                            
                                                            | 1097 | 1097 |  			} | 
                                                                                                            
                                                            | 1098 | 1098 |   | 
                                                                                                            
                                                            | 1099 | 1099 |  			if (!empty($page)) { | 
                                                                                                            
                                                            | 1100 |  | -				$out .= '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 1100 | +				$out .= '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 1101 | 1101 |  				$out .= '<input type="hidden" name="action" value="set_incoterms">'; | 
                                                                                                            
                                                            | 1102 |  | -				$out .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 1102 | +				$out .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 1103 | 1103 |  			} | 
                                                                                                            
                                                            | 1104 | 1104 |   | 
                                                                                                            
                                                            | 1105 |  | -			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; | 
                                                                                                            
                                                            |  | 1105 | +			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; | 
                                                                                                            
                                                            | 1106 | 1106 |  			$out .= '<option value="0"> </option>'; | 
                                                                                                            
                                                            | 1107 | 1107 |  			$num = $this->db->num_rows($resql); | 
                                                                                                            
                                                            | 1108 | 1108 |  			$i = 0; | 
                                                                                                                                                        
                                                        |  | @@ -1116,9 +1116,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1116 | 1116 |   | 
                                                                                                            
                                                            | 1117 | 1117 |  				foreach ($incotermArray as $row) { | 
                                                                                                            
                                                            | 1118 | 1118 |  					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { | 
                                                                                                            
                                                            | 1119 |  | -						$out .= '<option value="' . $row['rowid'] . '" selected>'; | 
                                                                                                            
                                                            |  | 1119 | +						$out .= '<option value="'.$row['rowid'].'" selected>'; | 
                                                                                                            
                                                            | 1120 | 1120 |  					} else { | 
                                                                                                            
                                                            | 1121 |  | -						$out .= '<option value="' . $row['rowid'] . '">'; | 
                                                                                                            
                                                            |  | 1121 | +						$out .= '<option value="'.$row['rowid'].'">'; | 
                                                                                                            
                                                            | 1122 | 1122 |  					} | 
                                                                                                            
                                                            | 1123 | 1123 |   | 
                                                                                                            
                                                            | 1124 | 1124 |  					if ($row['code']) { | 
                                                                                                                                                        
                                                        |  | @@ -1132,13 +1132,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1132 | 1132 |  			$out .= ajax_combobox($htmlname); | 
                                                                                                            
                                                            | 1133 | 1133 |   | 
                                                                                                            
                                                            | 1134 | 1134 |  			if ($conf->use_javascript_ajax && empty($disableautocomplete)) { | 
                                                                                                            
                                                            | 1135 |  | -				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; | 
                                                                                                            
                                                            |  | 1135 | +				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; | 
                                                                                                            
                                                            | 1136 | 1136 |  				//$moreattrib .= ' autocomplete="off"'; | 
                                                                                                            
                                                            | 1137 | 1137 |  			} | 
                                                                                                            
                                                            | 1138 |  | -			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; | 
                                                                                                            
                                                            |  | 1138 | +			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; | 
                                                                                                            
                                                            | 1139 | 1139 |   | 
                                                                                                            
                                                            | 1140 | 1140 |  			if (!empty($page)) { | 
                                                                                                            
                                                            | 1141 |  | -				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; | 
                                                                                                            
                                                            |  | 1141 | +				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; | 
                                                                                                            
                                                            | 1142 | 1142 |  			} | 
                                                                                                            
                                                            | 1143 | 1143 |  		} else { | 
                                                                                                            
                                                            | 1144 | 1144 |  			dol_print_error($this->db); | 
                                                                                                                                                        
                                                        |  | @@ -1173,7 +1173,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1173 | 1173 |  			if (empty($hidetext)) { | 
                                                                                                            
                                                            | 1174 | 1174 |  				print $langs->trans("Type").'...'; | 
                                                                                                            
                                                            | 1175 | 1175 |  			} | 
                                                                                                            
                                                            | 1176 |  | -			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 1176 | +			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 1177 | 1177 |  			if ($showempty) { | 
                                                                                                            
                                                            | 1178 | 1178 |  				print '<option value="-1" class="opacitymedium"'.($useajaxcombo ? '' : ' disabled="disabled"'); | 
                                                                                                            
                                                            | 1179 | 1179 |  				if ($selected == -1) { | 
                                                                                                                                                        
                                                        |  | @@ -1192,31 +1192,31 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1192 | 1192 |  			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { | 
                                                                                                            
                                                            | 1193 | 1193 |  				print ' selected'; | 
                                                                                                            
                                                            | 1194 | 1194 |  			} | 
                                                                                                            
                                                            | 1195 |  | -			print '>' . $langs->trans("Product"); | 
                                                                                                            
                                                            |  | 1195 | +			print '>'.$langs->trans("Product"); | 
                                                                                                            
                                                            | 1196 | 1196 |   | 
                                                                                                            
                                                            | 1197 | 1197 |  			print '<option value="1"'; | 
                                                                                                            
                                                            | 1198 | 1198 |  			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { | 
                                                                                                            
                                                            | 1199 | 1199 |  				print ' selected'; | 
                                                                                                            
                                                            | 1200 | 1200 |  			} | 
                                                                                                            
                                                            | 1201 |  | -			print '>' . $langs->trans("Service"); | 
                                                                                                            
                                                            |  | 1201 | +			print '>'.$langs->trans("Service"); | 
                                                                                                            
                                                            | 1202 | 1202 |   | 
                                                                                                            
                                                            | 1203 | 1203 |  			print '</select>'; | 
                                                                                                            
                                                            | 1204 | 1204 |   | 
                                                                                                            
                                                            | 1205 | 1205 |  			if ($useajaxcombo) { | 
                                                                                                            
                                                            | 1206 |  | -				print ajax_combobox('select_' . $htmlname); | 
                                                                                                            
                                                            |  | 1206 | +				print ajax_combobox('select_'.$htmlname); | 
                                                                                                            
                                                            | 1207 | 1207 |  			} | 
                                                                                                            
                                                            | 1208 | 1208 |  			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); | 
                                                                                                            
                                                            | 1209 | 1209 |  		} | 
                                                                                                            
                                                            | 1210 | 1210 |  		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { | 
                                                                                                            
                                                            | 1211 | 1211 |  			print $langs->trans("Service"); | 
                                                                                                            
                                                            | 1212 |  | -			print '<input type="hidden" name="' . $htmlname . '" value="1">'; | 
                                                                                                            
                                                            |  | 1212 | +			print '<input type="hidden" name="'.$htmlname.'" value="1">'; | 
                                                                                                            
                                                            | 1213 | 1213 |  		} | 
                                                                                                            
                                                            | 1214 | 1214 |  		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { | 
                                                                                                            
                                                            | 1215 | 1215 |  			print $langs->trans("Product"); | 
                                                                                                            
                                                            | 1216 |  | -			print '<input type="hidden" name="' . $htmlname . '" value="0">'; | 
                                                                                                            
                                                            |  | 1216 | +			print '<input type="hidden" name="'.$htmlname.'" value="0">'; | 
                                                                                                            
                                                            | 1217 | 1217 |  		} | 
                                                                                                            
                                                            | 1218 | 1218 |  		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled. | 
                                                                                                            
                                                            | 1219 |  | -			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 | 
                                                                                                            
                                                            |  | 1219 | +			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 | 
                                                                                                            
                                                            | 1220 | 1220 |  		} | 
                                                                                                            
                                                            | 1221 | 1221 |  	} | 
                                                                                                            
                                                            | 1222 | 1222 |   | 
                                                                                                                                                        
                                                        |  | @@ -1242,7 +1242,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1242 | 1242 |  		$langs->load("trips"); | 
                                                                                                            
                                                            | 1243 | 1243 |   | 
                                                                                                            
                                                            | 1244 | 1244 |  		$sql = "SELECT c.code, c.label"; | 
                                                                                                            
                                                            | 1245 |  | -		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; | 
                                                                                                            
                                                            |  | 1245 | +		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; | 
                                                                                                            
                                                            | 1246 | 1246 |  		$sql .= " WHERE active > 0"; | 
                                                                                                            
                                                            | 1247 | 1247 |   | 
                                                                                                            
                                                            | 1248 | 1248 |  		$resql = $this->db->query($sql); | 
                                                                                                                                                        
                                                        |  | @@ -1283,11 +1283,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1283 | 1283 |  		// phpcs:enable | 
                                                                                                            
                                                            | 1284 | 1284 |  		global $user, $langs; | 
                                                                                                            
                                                            | 1285 | 1285 |   | 
                                                                                                            
                                                            | 1286 |  | -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 1286 | +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            | 1287 | 1287 |   | 
                                                                                                            
                                                            | 1288 | 1288 |  		$this->load_cache_types_fees(); | 
                                                                                                            
                                                            | 1289 | 1289 |   | 
                                                                                                            
                                                            | 1290 |  | -		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 1290 | +		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 1291 | 1291 |  		if ($showempty) { | 
                                                                                                            
                                                            | 1292 | 1292 |  			print '<option value="-1"'; | 
                                                                                                            
                                                            | 1293 | 1293 |  			if ($selected == -1) { | 
                                                                                                                                                        
                                                        |  | @@ -1297,7 +1297,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1297 | 1297 |  		} | 
                                                                                                            
                                                            | 1298 | 1298 |   | 
                                                                                                            
                                                            | 1299 | 1299 |  		foreach ($this->cache_types_fees as $key => $value) { | 
                                                                                                            
                                                            | 1300 |  | -			print '<option value="' . $key . '"'; | 
                                                                                                            
                                                            |  | 1300 | +			print '<option value="'.$key.'"'; | 
                                                                                                            
                                                            | 1301 | 1301 |  			if ($key == $selected) { | 
                                                                                                            
                                                            | 1302 | 1302 |  				print ' selected'; | 
                                                                                                            
                                                            | 1303 | 1303 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -1349,12 +1349,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1349 | 1349 |  				$ajaxoptions = array(); | 
                                                                                                            
                                                            | 1350 | 1350 |  			} | 
                                                                                                            
                                                            | 1351 | 1351 |   | 
                                                                                                            
                                                            | 1352 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 1352 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 1353 | 1353 |   | 
                                                                                                            
                                                            | 1354 | 1354 |  			// No immediate load of all database | 
                                                                                                            
                                                            | 1355 | 1355 |  			$placeholder = ''; | 
                                                                                                            
                                                            | 1356 | 1356 |  			if ($selected && empty($selected_input_value)) { | 
                                                                                                            
                                                            | 1357 |  | -				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; | 
                                                                                                            
                                                            |  | 1357 | +				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; | 
                                                                                                            
                                                            | 1358 | 1358 |  				$societetmp = new Societe($this->db); | 
                                                                                                            
                                                            | 1359 | 1359 |  				$societetmp->fetch($selected); | 
                                                                                                            
                                                            | 1360 | 1360 |  				$selected_input_value = $societetmp->name; | 
                                                                                                                                                        
                                                        |  | @@ -1362,11 +1362,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1362 | 1362 |  			} | 
                                                                                                            
                                                            | 1363 | 1363 |   | 
                                                                                                            
                                                            | 1364 | 1364 |  			// mode 1 | 
                                                                                                            
                                                            | 1365 |  | -			$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)) : ''); | 
                                                                                                            
                                                            |  | 1365 | +			$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)) : ''); | 
                                                                                                            
                                                            | 1366 | 1366 |   | 
                                                                                                            
                                                            | 1367 | 1367 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                                                                            
                                                            | 1368 | 1368 |  			if (empty($hidelabel)) { | 
                                                                                                            
                                                            | 1369 |  | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                                                                            
                                                            |  | 1369 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                                                                            
                                                            | 1370 | 1370 |  			} elseif ($hidelabel == 1 && !is_numeric($showempty)) { | 
                                                                                                            
                                                            | 1371 | 1371 |  				$placeholder = $langs->trans($showempty); | 
                                                                                                            
                                                            | 1372 | 1372 |  			} elseif ($hidelabel > 1) { | 
                                                                                                                                                        
                                                        |  | @@ -1375,7 +1375,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1375 | 1375 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 1376 | 1376 |  				} | 
                                                                                                            
                                                            | 1377 | 1377 |  			} | 
                                                                                                            
                                                            | 1378 |  | -			$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' : '') . ' />'; | 
                                                                                                            
                                                            |  | 1378 | +			$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' : '').' />'; | 
                                                                                                            
                                                            | 1379 | 1379 |  			if ($hidelabel == 3) { | 
                                                                                                            
                                                            | 1380 | 1380 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 1381 | 1381 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -1437,12 +1437,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1437 | 1437 |  				$events = array(); | 
                                                                                                            
                                                            | 1438 | 1438 |  			} | 
                                                                                                            
                                                            | 1439 | 1439 |   | 
                                                                                                            
                                                            | 1440 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 1440 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 1441 | 1441 |   | 
                                                                                                            
                                                            | 1442 | 1442 |  			// No immediate load of all database | 
                                                                                                            
                                                            | 1443 | 1443 |  			$placeholder = ''; | 
                                                                                                            
                                                            | 1444 | 1444 |  			if ($selected && empty($selected_input_value)) { | 
                                                                                                            
                                                            | 1445 |  | -				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; | 
                                                                                                            
                                                            |  | 1445 | +				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; | 
                                                                                                            
                                                            | 1446 | 1446 |  				$contacttmp = new Contact($this->db); | 
                                                                                                            
                                                            | 1447 | 1447 |  				$contacttmp->fetch($selected); | 
                                                                                                            
                                                            | 1448 | 1448 |  				$selected_input_value = $contacttmp->getFullName($langs); | 
                                                                                                                                                        
                                                        |  | @@ -1453,11 +1453,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1453 | 1453 |  			} | 
                                                                                                            
                                                            | 1454 | 1454 |   | 
                                                                                                            
                                                            | 1455 | 1455 |  			// mode 1 | 
                                                                                                            
                                                            | 1456 |  | -			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); | 
                                                                                                            
                                                            |  | 1456 | +			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); | 
                                                                                                            
                                                            | 1457 | 1457 |   | 
                                                                                                            
                                                            | 1458 | 1458 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                                                                            
                                                            | 1459 | 1459 |   | 
                                                                                                            
                                                            | 1460 |  | -			$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' : '') . ' />'; | 
                                                                                                            
                                                            |  | 1460 | +			$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' : '').' />'; | 
                                                                                                            
                                                            | 1461 | 1461 |   | 
                                                                                                            
                                                            | 1462 | 1462 |  			$out .= ajax_event($htmlname, $events); | 
                                                                                                            
                                                            | 1463 | 1463 |   | 
                                                                                                                                                        
                                                        |  | @@ -1556,30 +1556,30 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1556 | 1556 |  			$sql .= ", s.address, s.zip, s.town"; | 
                                                                                                            
                                                            | 1557 | 1557 |  			$sql .= ", dictp.code as country_code"; | 
                                                                                                            
                                                            | 1558 | 1558 |  		} | 
                                                                                                            
                                                            | 1559 |  | -		$sql .= " FROM " . $this->db->prefix() . "societe as s"; | 
                                                                                                            
                                                            |  | 1559 | +		$sql .= " FROM ".$this->db->prefix()."societe as s"; | 
                                                                                                            
                                                            | 1560 | 1560 |  		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                                                                            
                                                            | 1561 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; | 
                                                                                                            
                                                            |  | 1561 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; | 
                                                                                                            
                                                            | 1562 | 1562 |  		} | 
                                                                                                            
                                                            | 1563 | 1563 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                                                                            
                                                            | 1564 |  | -			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; | 
                                                                                                            
                                                            |  | 1564 | +			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; | 
                                                                                                            
                                                            | 1565 | 1565 |  		} | 
                                                                                                            
                                                            | 1566 |  | -		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; | 
                                                                                                            
                                                            |  | 1566 | +		$sql .= " WHERE s.entity IN (".getEntity('societe').")"; | 
                                                                                                            
                                                            | 1567 | 1567 |  		if (!empty($user->socid)) { | 
                                                                                                            
                                                            | 1568 |  | -			$sql .= " AND s.rowid = " . ((int) $user->socid); | 
                                                                                                            
                                                            |  | 1568 | +			$sql .= " AND s.rowid = ".((int) $user->socid); | 
                                                                                                            
                                                            | 1569 | 1569 |  		} | 
                                                                                                            
                                                            | 1570 | 1570 |  		if ($filter) { | 
                                                                                                            
                                                            | 1571 | 1571 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                                                                            
                                                            | 1572 | 1572 |  			// if not, by testSqlAndScriptInject() only. | 
                                                                                                            
                                                            | 1573 |  | -			$sql .= " AND (" . $filter . ")"; | 
                                                                                                            
                                                            |  | 1573 | +			$sql .= " AND (".$filter.")"; | 
                                                                                                            
                                                            | 1574 | 1574 |  		} | 
                                                                                                            
                                                            | 1575 | 1575 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                                                                            
                                                            | 1576 |  | -			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); | 
                                                                                                            
                                                            |  | 1576 | +			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); | 
                                                                                                            
                                                            | 1577 | 1577 |  		} | 
                                                                                                            
                                                            | 1578 | 1578 |  		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                                                                            
                                                            | 1579 | 1579 |  			$sql .= " AND s.status <> 0"; | 
                                                                                                            
                                                            | 1580 | 1580 |  		} | 
                                                                                                            
                                                            | 1581 | 1581 |  		if (!empty($excludeids)) { | 
                                                                                                            
                                                            | 1582 |  | -			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; | 
                                                                                                            
                                                            |  | 1582 | +			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; | 
                                                                                                            
                                                            | 1583 | 1583 |  		} | 
                                                                                                            
                                                            | 1584 | 1584 |  		// Add where from hooks | 
                                                                                                            
                                                            | 1585 | 1585 |  		$parameters = array(); | 
                                                                                                                                                        
                                                        |  | @@ -1599,17 +1599,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1599 | 1599 |  				if ($i > 0) { | 
                                                                                                            
                                                            | 1600 | 1600 |  					$sql .= " AND "; | 
                                                                                                            
                                                            | 1601 | 1601 |  				} | 
                                                                                                            
                                                            | 1602 |  | -				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; | 
                                                                                                            
                                                            |  | 1602 | +				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; | 
                                                                                                            
                                                            | 1603 | 1603 |  				$i++; | 
                                                                                                            
                                                            | 1604 | 1604 |  			} | 
                                                                                                            
                                                            | 1605 | 1605 |  			if (count($search_crit) > 1) { | 
                                                                                                            
                                                            | 1606 | 1606 |  				$sql .= ")"; | 
                                                                                                            
                                                            | 1607 | 1607 |  			} | 
                                                                                                            
                                                            | 1608 | 1608 |  			if (isModEnabled('barcode')) { | 
                                                                                                            
                                                            | 1609 |  | -				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; | 
                                                                                                            
                                                            |  | 1609 | +				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; | 
                                                                                                            
                                                            | 1610 | 1610 |  			} | 
                                                                                                            
                                                            | 1611 |  | -			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; | 
                                                                                                            
                                                            | 1612 |  | -			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; | 
                                                                                                            
                                                            |  | 1611 | +			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; | 
                                                                                                            
                                                            |  | 1612 | +			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; | 
                                                                                                            
                                                            | 1613 | 1613 |  			$sql .= ")"; | 
                                                                                                            
                                                            | 1614 | 1614 |  		} | 
                                                                                                            
                                                            | 1615 | 1615 |  		$sql .= $this->db->order("nom", "ASC"); | 
                                                                                                                                                        
                                                        |  | @@ -1620,7 +1620,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1620 | 1620 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 1621 | 1621 |  		if ($resql) { | 
                                                                                                            
                                                            | 1622 | 1622 |  			// Construct $out and $outarray | 
                                                                                                            
                                                            | 1623 |  | -			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; | 
                                                                                                            
                                                            |  | 1623 | +			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; | 
                                                                                                            
                                                            | 1624 | 1624 |   | 
                                                                                                            
                                                            | 1625 | 1625 |  			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); | 
                                                                                                            
                                                            | 1626 | 1626 |  			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { | 
                                                                                                                                                        
                                                        |  | @@ -1633,7 +1633,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1633 | 1633 |  				} | 
                                                                                                            
                                                            | 1634 | 1634 |  			} | 
                                                                                                            
                                                            | 1635 | 1635 |  			if ($showempty) { | 
                                                                                                            
                                                            | 1636 |  | -				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 1636 | +				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; | 
                                                                                                            
                                                            | 1637 | 1637 |  			} | 
                                                                                                            
                                                            | 1638 | 1638 |   | 
                                                                                                            
                                                            | 1639 | 1639 |  			$companytemp = new Societe($this->db); | 
                                                                                                                                                        
                                                        |  | @@ -1646,18 +1646,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1646 | 1646 |  					$label = ''; | 
                                                                                                            
                                                            | 1647 | 1647 |  					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { | 
                                                                                                            
                                                            | 1648 | 1648 |  						if (($obj->client) && (!empty($obj->code_client))) { | 
                                                                                                            
                                                            | 1649 |  | -							$label = $obj->code_client . ' - '; | 
                                                                                                            
                                                            |  | 1649 | +							$label = $obj->code_client.' - '; | 
                                                                                                            
                                                            | 1650 | 1650 |  						} | 
                                                                                                            
                                                            | 1651 | 1651 |  						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { | 
                                                                                                            
                                                            | 1652 |  | -							$label .= $obj->code_fournisseur . ' - '; | 
                                                                                                            
                                                            |  | 1652 | +							$label .= $obj->code_fournisseur.' - '; | 
                                                                                                            
                                                            | 1653 | 1653 |  						} | 
                                                                                                            
                                                            | 1654 |  | -						$label .= ' ' . $obj->name; | 
                                                                                                            
                                                            |  | 1654 | +						$label .= ' '.$obj->name; | 
                                                                                                            
                                                            | 1655 | 1655 |  					} else { | 
                                                                                                            
                                                            | 1656 | 1656 |  						$label = $obj->name; | 
                                                                                                            
                                                            | 1657 | 1657 |  					} | 
                                                                                                            
                                                            | 1658 | 1658 |   | 
                                                                                                            
                                                            | 1659 | 1659 |  					if (!empty($obj->name_alias)) { | 
                                                                                                            
                                                            | 1660 |  | -						$label .= ' (' . $obj->name_alias . ')'; | 
                                                                                                            
                                                            |  | 1660 | +						$label .= ' ('.$obj->name_alias.')'; | 
                                                                                                            
                                                            | 1661 | 1661 |  					} | 
                                                                                                            
                                                            | 1662 | 1662 |   | 
                                                                                                            
                                                            | 1663 | 1663 |  					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { | 
                                                                                                                                                        
                                                        |  | @@ -1672,7 +1672,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1672 | 1672 |  						$companytemp->fournisseur = $obj->fournisseur; | 
                                                                                                            
                                                            | 1673 | 1673 |  						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); | 
                                                                                                            
                                                            | 1674 | 1674 |  						if ($tmptype) { | 
                                                                                                            
                                                            | 1675 |  | -							$labelhtml .= ' ' . $tmptype; | 
                                                                                                            
                                                            |  | 1675 | +							$labelhtml .= ' '.$tmptype; | 
                                                                                                            
                                                            | 1676 | 1676 |  						} | 
                                                                                                            
                                                            | 1677 | 1677 |   | 
                                                                                                            
                                                            | 1678 | 1678 |  						if ($obj->client || $obj->fournisseur) { | 
                                                                                                                                                        
                                                        |  | @@ -1682,10 +1682,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1682 | 1682 |  							$label .= $langs->trans("Customer"); | 
                                                                                                            
                                                            | 1683 | 1683 |  						} | 
                                                                                                            
                                                            | 1684 | 1684 |  						if ($obj->client == 2 || $obj->client == 3) { | 
                                                                                                            
                                                            | 1685 |  | -							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); | 
                                                                                                            
                                                            |  | 1685 | +							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); | 
                                                                                                            
                                                            | 1686 | 1686 |  						} | 
                                                                                                            
                                                            | 1687 | 1687 |  						if ($obj->fournisseur) { | 
                                                                                                            
                                                            | 1688 |  | -							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); | 
                                                                                                            
                                                            |  | 1688 | +							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); | 
                                                                                                            
                                                            | 1689 | 1689 |  						} | 
                                                                                                            
                                                            | 1690 | 1690 |  						if ($obj->client || $obj->fournisseur) { | 
                                                                                                            
                                                            | 1691 | 1691 |  							$label .= ')'; | 
                                                                                                                                                        
                                                        |  | @@ -1693,9 +1693,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1693 | 1693 |  					} | 
                                                                                                            
                                                            | 1694 | 1694 |   | 
                                                                                                            
                                                            | 1695 | 1695 |  					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                                                                            
                                                            | 1696 |  | -						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); | 
                                                                                                            
                                                            |  | 1696 | +						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); | 
                                                                                                            
                                                            | 1697 | 1697 |  						if (!empty($obj->country_code)) { | 
                                                                                                            
                                                            | 1698 |  | -							$s .= ', ' . $langs->trans('Country' . $obj->country_code); | 
                                                                                                            
                                                            |  | 1698 | +							$s .= ', '.$langs->trans('Country'.$obj->country_code); | 
                                                                                                            
                                                            | 1699 | 1699 |  						} | 
                                                                                                            
                                                            | 1700 | 1700 |  						$label .= $s; | 
                                                                                                            
                                                            | 1701 | 1701 |  						$labelhtml .= $s; | 
                                                                                                                                                        
                                                        |  | @@ -1703,9 +1703,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1703 | 1703 |   | 
                                                                                                            
                                                            | 1704 | 1704 |  					if (empty($outputmode)) { | 
                                                                                                            
                                                            | 1705 | 1705 |  						if (in_array($obj->rowid, $selected)) { | 
                                                                                                            
                                                            | 1706 |  | -							$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>'; | 
                                                                                                            
                                                            |  | 1706 | +							$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>'; | 
                                                                                                            
                                                            | 1707 | 1707 |  						} else { | 
                                                                                                            
                                                            | 1708 |  | -							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; | 
                                                                                                            
                                                            |  | 1708 | +							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; | 
                                                                                                            
                                                            | 1709 | 1709 |  						} | 
                                                                                                            
                                                            | 1710 | 1710 |  					} else { | 
                                                                                                            
                                                            | 1711 | 1711 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); | 
                                                                                                                                                        
                                                        |  | @@ -1717,9 +1717,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1717 | 1717 |  					} | 
                                                                                                            
                                                            | 1718 | 1718 |  				} | 
                                                                                                            
                                                            | 1719 | 1719 |  			} | 
                                                                                                            
                                                            | 1720 |  | -			$out .= '</select>' . "\n"; | 
                                                                                                            
                                                            |  | 1720 | +			$out .= '</select>'."\n"; | 
                                                                                                            
                                                            | 1721 | 1721 |  			if (!$forcecombo) { | 
                                                                                                            
                                                            | 1722 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 1722 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 1723 | 1723 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); | 
                                                                                                            
                                                            | 1724 | 1724 |  			} | 
                                                                                                            
                                                            | 1725 | 1725 |  		} else { | 
                                                                                                                                                        
                                                        |  | @@ -1808,7 +1808,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1808 | 1808 |  		} | 
                                                                                                            
                                                            | 1809 | 1809 |   | 
                                                                                                            
                                                            | 1810 | 1810 |  		if (!is_object($hookmanager)) { | 
                                                                                                            
                                                            | 1811 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; | 
                                                                                                            
                                                            |  | 1811 | +			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; | 
                                                                                                            
                                                            | 1812 | 1812 |  			$hookmanager = new HookManager($this->db); | 
                                                                                                            
                                                            | 1813 | 1813 |  		} | 
                                                                                                            
                                                            | 1814 | 1814 |   | 
                                                                                                                                                        
                                                        |  | @@ -1817,14 +1817,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1817 | 1817 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                                                                            
                                                            | 1818 | 1818 |  			$sql .= ", s.nom as company, s.town AS company_town"; | 
                                                                                                            
                                                            | 1819 | 1819 |  		} | 
                                                                                                            
                                                            | 1820 |  | -		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; | 
                                                                                                            
                                                            |  | 1820 | +		$sql .= " FROM ".$this->db->prefix()."socpeople as sp"; | 
                                                                                                            
                                                            | 1821 | 1821 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                                                                            
                                                            | 1822 |  | -			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; | 
                                                                                                            
                                                            |  | 1822 | +			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; | 
                                                                                                            
                                                            | 1823 | 1823 |  		} | 
                                                                                                            
                                                            | 1824 |  | -		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; | 
                                                                                                            
                                                            |  | 1824 | +		$sql .= " WHERE sp.entity IN (".getEntity('contact').")"; | 
                                                                                                            
                                                            | 1825 | 1825 |  		$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact | 
                                                                                                            
                                                            | 1826 | 1826 |  		if ($socid > 0 || $socid == -1) { | 
                                                                                                            
                                                            | 1827 |  | -			$sql .= " AND sp.fk_soc = " . ((int) $socid); | 
                                                                                                            
                                                            |  | 1827 | +			$sql .= " AND sp.fk_soc = ".((int) $socid); | 
                                                                                                            
                                                            | 1828 | 1828 |  		} | 
                                                                                                            
                                                            | 1829 | 1829 |  		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                                                                            
                                                            | 1830 | 1830 |  			$sql .= " AND sp.statut <> 0"; | 
                                                                                                                                                        
                                                        |  | @@ -1832,7 +1832,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1832 | 1832 |  		if ($filter) { | 
                                                                                                            
                                                            | 1833 | 1833 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                                                                            
                                                            | 1834 | 1834 |  			// if not, by testSqlAndScriptInject() only. | 
                                                                                                            
                                                            | 1835 |  | -			$sql .= " AND (" . $filter . ")"; | 
                                                                                                            
                                                            |  | 1835 | +			$sql .= " AND (".$filter.")"; | 
                                                                                                            
                                                            | 1836 | 1836 |  		} | 
                                                                                                            
                                                            | 1837 | 1837 |  		// Add where from hooks | 
                                                                                                            
                                                            | 1838 | 1838 |  		$parameters = array(); | 
                                                                                                                                                        
                                                        |  | @@ -1840,30 +1840,30 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1840 | 1840 |  		$sql .= $hookmanager->resPrint; | 
                                                                                                            
                                                            | 1841 | 1841 |  		$sql .= " ORDER BY sp.lastname ASC"; | 
                                                                                                            
                                                            | 1842 | 1842 |   | 
                                                                                                            
                                                            | 1843 |  | -		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 1843 | +		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); | 
                                                                                                            
                                                            | 1844 | 1844 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 1845 | 1845 |  		if ($resql) { | 
                                                                                                            
                                                            | 1846 | 1846 |  			$num = $this->db->num_rows($resql); | 
                                                                                                            
                                                            | 1847 | 1847 |   | 
                                                                                                            
                                                            | 1848 | 1848 |  			if ($htmlname != 'none' && !$options_only) { | 
                                                                                                            
                                                            | 1849 |  | -				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; | 
                                                                                                            
                                                            |  | 1849 | +				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; | 
                                                                                                            
                                                            | 1850 | 1850 |  			} | 
                                                                                                            
                                                            | 1851 | 1851 |   | 
                                                                                                            
                                                            | 1852 | 1852 |  			if ($showempty && !is_numeric($showempty)) { | 
                                                                                                            
                                                            | 1853 | 1853 |  				$textforempty = $showempty; | 
                                                                                                            
                                                            | 1854 |  | -				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; | 
                                                                                                            
                                                            |  | 1854 | +				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; | 
                                                                                                            
                                                            | 1855 | 1855 |  			} else { | 
                                                                                                            
                                                            | 1856 | 1856 |  				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { | 
                                                                                                            
                                                            | 1857 |  | -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; | 
                                                                                                            
                                                            |  | 1857 | +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; | 
                                                                                                            
                                                            | 1858 | 1858 |  				} | 
                                                                                                            
                                                            | 1859 | 1859 |  				if ($showempty == 2) { | 
                                                                                                            
                                                            | 1860 |  | -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; | 
                                                                                                            
                                                            |  | 1860 | +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; | 
                                                                                                            
                                                            | 1861 | 1861 |  				} | 
                                                                                                            
                                                            | 1862 | 1862 |  			} | 
                                                                                                            
                                                            | 1863 | 1863 |   | 
                                                                                                            
                                                            | 1864 | 1864 |  			$i = 0; | 
                                                                                                            
                                                            | 1865 | 1865 |  			if ($num) { | 
                                                                                                            
                                                            | 1866 |  | -				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; | 
                                                                                                            
                                                            |  | 1866 | +				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; | 
                                                                                                            
                                                            | 1867 | 1867 |  				$contactstatic = new Contact($this->db); | 
                                                                                                            
                                                            | 1868 | 1868 |   | 
                                                                                                            
                                                            | 1869 | 1869 |  				while ($i < $num) { | 
                                                                                                                                                        
                                                        |  | @@ -1899,7 +1899,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1899 | 1899 |  						} | 
                                                                                                            
                                                            | 1900 | 1900 |  						$extendedInfos = implode(' - ', $extendedInfos); | 
                                                                                                            
                                                            | 1901 | 1901 |  						if (!empty($extendedInfos)) { | 
                                                                                                            
                                                            | 1902 |  | -							$extendedInfos = ' - ' . $extendedInfos; | 
                                                                                                            
                                                            |  | 1902 | +							$extendedInfos = ' - '.$extendedInfos; | 
                                                                                                            
                                                            | 1903 | 1903 |  						} | 
                                                                                                            
                                                            | 1904 | 1904 |  					} | 
                                                                                                            
                                                            | 1905 | 1905 |   | 
                                                                                                                                                        
                                                        |  | @@ -1917,35 +1917,35 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1917 | 1917 |  								$disabled = 1; | 
                                                                                                            
                                                            | 1918 | 1918 |  							} | 
                                                                                                            
                                                            | 1919 | 1919 |  							if (!empty($selected) && in_array($obj->rowid, $selected)) { | 
                                                                                                            
                                                            | 1920 |  | -								$out .= '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 1920 | +								$out .= '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 1921 | 1921 |  								if ($disabled) { | 
                                                                                                            
                                                            | 1922 | 1922 |  									$out .= ' disabled'; | 
                                                                                                            
                                                            | 1923 | 1923 |  								} | 
                                                                                                            
                                                            | 1924 | 1924 |  								$out .= ' selected>'; | 
                                                                                                            
                                                            | 1925 | 1925 |   | 
                                                                                                            
                                                            | 1926 |  | -								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; | 
                                                                                                            
                                                            |  | 1926 | +								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos; | 
                                                                                                            
                                                            | 1927 | 1927 |  								if ($showfunction && $obj->poste) { | 
                                                                                                            
                                                            | 1928 |  | -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                                                                            
                                                            |  | 1928 | +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                                                                            
                                                            | 1929 | 1929 |  								} | 
                                                                                                            
                                                            | 1930 | 1930 |  								if (($showsoc > 0) && $obj->company) { | 
                                                                                                            
                                                            | 1931 |  | -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                                                                            
                                                            |  | 1931 | +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                                                                            
                                                            | 1932 | 1932 |  								} | 
                                                                                                            
                                                            | 1933 | 1933 |   | 
                                                                                                            
                                                            | 1934 | 1934 |  								$out .= $tmplabel; | 
                                                                                                            
                                                            | 1935 | 1935 |  								$out .= '</option>'; | 
                                                                                                            
                                                            | 1936 | 1936 |  							} else { | 
                                                                                                            
                                                            | 1937 |  | -								$out .= '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 1937 | +								$out .= '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 1938 | 1938 |  								if ($disabled) { | 
                                                                                                            
                                                            | 1939 | 1939 |  									$out .= ' disabled'; | 
                                                                                                            
                                                            | 1940 | 1940 |  								} | 
                                                                                                            
                                                            | 1941 | 1941 |  								$out .= '>'; | 
                                                                                                            
                                                            | 1942 | 1942 |   | 
                                                                                                            
                                                            | 1943 |  | -								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; | 
                                                                                                            
                                                            |  | 1943 | +								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos; | 
                                                                                                            
                                                            | 1944 | 1944 |  								if ($showfunction && $obj->poste) { | 
                                                                                                            
                                                            | 1945 |  | -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                                                                            
                                                            |  | 1945 | +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                                                                            
                                                            | 1946 | 1946 |  								} | 
                                                                                                            
                                                            | 1947 | 1947 |  								if (($showsoc > 0) && $obj->company) { | 
                                                                                                            
                                                            | 1948 |  | -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                                                                            
                                                            |  | 1948 | +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                                                                            
                                                            | 1949 | 1949 |  								} | 
                                                                                                            
                                                            | 1950 | 1950 |   | 
                                                                                                            
                                                            | 1951 | 1951 |  								$out .= $tmplabel; | 
                                                                                                                                                        
                                                        |  | @@ -1953,12 +1953,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1953 | 1953 |  							} | 
                                                                                                            
                                                            | 1954 | 1954 |  						} else { | 
                                                                                                            
                                                            | 1955 | 1955 |  							if (in_array($obj->rowid, $selected)) { | 
                                                                                                            
                                                            | 1956 |  | -								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; | 
                                                                                                            
                                                            |  | 1956 | +								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos; | 
                                                                                                            
                                                            | 1957 | 1957 |  								if ($showfunction && $obj->poste) { | 
                                                                                                            
                                                            | 1958 |  | -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                                                                            
                                                            |  | 1958 | +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                                                                            
                                                            | 1959 | 1959 |  								} | 
                                                                                                            
                                                            | 1960 | 1960 |  								if (($showsoc > 0) && $obj->company) { | 
                                                                                                            
                                                            | 1961 |  | -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                                                                            
                                                            |  | 1961 | +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                                                                            
                                                            | 1962 | 1962 |  								} | 
                                                                                                            
                                                            | 1963 | 1963 |   | 
                                                                                                            
                                                            | 1964 | 1964 |  								$out .= $tmplabel; | 
                                                                                                                                                        
                                                        |  | @@ -1973,7 +1973,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1973 | 1973 |  				} | 
                                                                                                            
                                                            | 1974 | 1974 |  			} else { | 
                                                                                                            
                                                            | 1975 | 1975 |  				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); | 
                                                                                                            
                                                            | 1976 |  | -				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; | 
                                                                                                            
                                                            |  | 1976 | +				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; | 
                                                                                                            
                                                            | 1977 | 1977 |  				$out .= $labeltoshow; | 
                                                                                                            
                                                            | 1978 | 1978 |  				$out .= '</option>'; | 
                                                                                                            
                                                            | 1979 | 1979 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -1994,7 +1994,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 1994 | 1994 |  			} | 
                                                                                                            
                                                            | 1995 | 1995 |   | 
                                                                                                            
                                                            | 1996 | 1996 |  			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { | 
                                                                                                            
                                                            | 1997 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 1997 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 1998 | 1998 |  				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); | 
                                                                                                            
                                                            | 1999 | 1999 |  			} | 
                                                                                                            
                                                            | 2000 | 2000 |   | 
                                                                                                                                                        
                                                        |  | @@ -2033,18 +2033,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2033 | 2033 |  		// On recherche les remises | 
                                                                                                            
                                                            | 2034 | 2034 |  		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; | 
                                                                                                            
                                                            | 2035 | 2035 |  		$sql .= " re.description, re.fk_facture_source"; | 
                                                                                                            
                                                            | 2036 |  | -		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; | 
                                                                                                            
                                                            | 2037 |  | -		$sql .= " WHERE re.fk_soc = " . (int) $socid; | 
                                                                                                            
                                                            | 2038 |  | -		$sql .= " AND re.entity = " . $conf->entity; | 
                                                                                                            
                                                            |  | 2036 | +		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; | 
                                                                                                            
                                                            |  | 2037 | +		$sql .= " WHERE re.fk_soc = ".(int) $socid; | 
                                                                                                            
                                                            |  | 2038 | +		$sql .= " AND re.entity = ".$conf->entity; | 
                                                                                                            
                                                            | 2039 | 2039 |  		if ($filter) { | 
                                                                                                            
                                                            | 2040 |  | -			$sql .= " AND " . $filter; | 
                                                                                                            
                                                            |  | 2040 | +			$sql .= " AND ".$filter; | 
                                                                                                            
                                                            | 2041 | 2041 |  		} | 
                                                                                                            
                                                            | 2042 | 2042 |  		$sql .= " ORDER BY re.description ASC"; | 
                                                                                                            
                                                            | 2043 | 2043 |   | 
                                                                                                            
                                                            | 2044 |  | -		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 2044 | +		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); | 
                                                                                                            
                                                            | 2045 | 2045 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 2046 | 2046 |  		if ($resql) { | 
                                                                                                            
                                                            | 2047 |  | -			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 2047 | +			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 2048 | 2048 |  			$num = $this->db->num_rows($resql); | 
                                                                                                            
                                                            | 2049 | 2049 |   | 
                                                                                                            
                                                            | 2050 | 2050 |  			$qualifiedlines = $num; | 
                                                                                                                                                        
                                                        |  | @@ -2082,16 +2082,16 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2082 | 2082 |  					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { | 
                                                                                                            
                                                            | 2083 | 2083 |  						$tmpfac = new Facture($this->db); | 
                                                                                                            
                                                            | 2084 | 2084 |  						if ($tmpfac->fetch($obj->fk_facture_source) > 0) { | 
                                                                                                            
                                                            | 2085 |  | -							$desc = $desc . ' - ' . $tmpfac->ref; | 
                                                                                                            
                                                            |  | 2085 | +							$desc = $desc.' - '.$tmpfac->ref; | 
                                                                                                            
                                                            | 2086 | 2086 |  						} | 
                                                                                                            
                                                            | 2087 | 2087 |  					} | 
                                                                                                            
                                                            | 2088 | 2088 |   | 
                                                                                                            
                                                            | 2089 |  | -					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; | 
                                                                                                            
                                                            |  | 2089 | +					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; | 
                                                                                                            
                                                            | 2090 | 2090 |  					$i++; | 
                                                                                                            
                                                            | 2091 | 2091 |  				} | 
                                                                                                            
                                                            | 2092 | 2092 |  			} | 
                                                                                                            
                                                            | 2093 | 2093 |  			print '</select>'; | 
                                                                                                            
                                                            | 2094 |  | -			print ajax_combobox('select_' . $htmlname); | 
                                                                                                            
                                                            |  | 2094 | +			print ajax_combobox('select_'.$htmlname); | 
                                                                                                            
                                                            | 2095 | 2095 |   | 
                                                                                                            
                                                            | 2096 | 2096 |  			return $qualifiedlines; | 
                                                                                                            
                                                            | 2097 | 2097 |  		} else { | 
                                                                                                                                                        
                                                        |  | @@ -2200,14 +2200,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2200 | 2200 |  		if ($showlabelofentity) { | 
                                                                                                            
                                                            | 2201 | 2201 |  			$sql .= ", e.label"; | 
                                                                                                            
                                                            | 2202 | 2202 |  		} | 
                                                                                                            
                                                            | 2203 |  | -		$sql .= " FROM " . $this->db->prefix() . "user as u"; | 
                                                                                                            
                                                            |  | 2203 | +		$sql .= " FROM ".$this->db->prefix()."user as u"; | 
                                                                                                            
                                                            | 2204 | 2204 |  		if ($showlabelofentity) { | 
                                                                                                            
                                                            | 2205 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; | 
                                                                                                            
                                                            |  | 2205 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; | 
                                                                                                            
                                                            | 2206 | 2206 |  		} | 
                                                                                                            
                                                            | 2207 | 2207 |  		// Condition here should be the same than into societe->getSalesRepresentatives(). | 
                                                                                                            
                                                            | 2208 | 2208 |  		if ($userissuperadminentityone && $force_entity !== 'default') { | 
                                                                                                            
                                                            | 2209 | 2209 |  			if (!empty($force_entity)) { | 
                                                                                                            
                                                            | 2210 |  | -				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; | 
                                                                                                            
                                                            |  | 2210 | +				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; | 
                                                                                                            
                                                            | 2211 | 2211 |  			} else { | 
                                                                                                            
                                                            | 2212 | 2212 |  				$sql .= " WHERE u.entity IS NOT NULL"; | 
                                                                                                            
                                                            | 2213 | 2213 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -2215,18 +2215,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2215 | 2215 |  			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { | 
                                                                                                            
                                                            | 2216 | 2216 |  				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; | 
                                                                                                            
                                                            | 2217 | 2217 |  			} else { | 
                                                                                                            
                                                            | 2218 |  | -				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; | 
                                                                                                            
                                                            |  | 2218 | +				$sql .= " WHERE u.entity IN (".getEntity('user').")"; | 
                                                                                                            
                                                            | 2219 | 2219 |  			} | 
                                                                                                            
                                                            | 2220 | 2220 |  		} | 
                                                                                                            
                                                            | 2221 | 2221 |   | 
                                                                                                            
                                                            | 2222 | 2222 |  		if (!empty($user->socid)) { | 
                                                                                                            
                                                            | 2223 |  | -			$sql .= " AND u.fk_soc = " . ((int) $user->socid); | 
                                                                                                            
                                                            |  | 2223 | +			$sql .= " AND u.fk_soc = ".((int) $user->socid); | 
                                                                                                            
                                                            | 2224 | 2224 |  		} | 
                                                                                                            
                                                            | 2225 | 2225 |  		if (is_array($exclude) && $excludeUsers) { | 
                                                                                                            
                                                            | 2226 |  | -			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; | 
                                                                                                            
                                                            |  | 2226 | +			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; | 
                                                                                                            
                                                            | 2227 | 2227 |  		} | 
                                                                                                            
                                                            | 2228 | 2228 |  		if ($includeUsers) { | 
                                                                                                            
                                                            | 2229 |  | -			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; | 
                                                                                                            
                                                            |  | 2229 | +			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; | 
                                                                                                            
                                                            | 2230 | 2230 |  		} | 
                                                                                                            
                                                            | 2231 | 2231 |  		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { | 
                                                                                                            
                                                            | 2232 | 2232 |  			$sql .= " AND u.statut <> 0"; | 
                                                                                                                                                        
                                                        |  | @@ -2263,7 +2263,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2263 | 2263 |  			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; | 
                                                                                                            
                                                            | 2264 | 2264 |  		} | 
                                                                                                            
                                                            | 2265 | 2265 |   | 
                                                                                                            
                                                            | 2266 |  | -		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 2266 | +		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); | 
                                                                                                            
                                                            | 2267 | 2267 |   | 
                                                                                                            
                                                            | 2268 | 2268 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 2269 | 2269 |  		if ($resql) { | 
                                                                                                                                                        
                                                        |  | @@ -2271,7 +2271,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2271 | 2271 |  			$i = 0; | 
                                                                                                            
                                                            | 2272 | 2272 |  			if ($num) { | 
                                                                                                            
                                                            | 2273 | 2273 |  				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined | 
                                                                                                            
                                                            | 2274 |  | -				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; | 
                                                                                                            
                                                            |  | 2274 | +				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; | 
                                                                                                            
                                                            | 2275 | 2275 |  				if ($show_empty && !$multiple) { | 
                                                                                                            
                                                            | 2276 | 2276 |  					$textforempty = ' '; | 
                                                                                                            
                                                            | 2277 | 2277 |  					if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                                                                        
                                                        |  | @@ -2280,7 +2280,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2280 | 2280 |  					if (!is_numeric($show_empty)) { | 
                                                                                                            
                                                            | 2281 | 2281 |  						$textforempty = $show_empty; | 
                                                                                                            
                                                            | 2282 | 2282 |  					} | 
                                                                                                            
                                                            | 2283 |  | -					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 2283 | +					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; | 
                                                                                                            
                                                            | 2284 | 2284 |   | 
                                                                                                            
                                                            | 2285 | 2285 |  					$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty; | 
                                                                                                            
                                                            | 2286 | 2286 |  					$outarray2[($show_empty < 0 ? $show_empty : -1)] = array( | 
                                                                                                                                                        
                                                        |  | @@ -2292,13 +2292,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2292 | 2292 |  					); | 
                                                                                                            
                                                            | 2293 | 2293 |  				} | 
                                                                                                            
                                                            | 2294 | 2294 |  				if ($show_every) { | 
                                                                                                            
                                                            | 2295 |  | -					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; | 
                                                                                                            
                                                            |  | 2295 | +					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; | 
                                                                                                            
                                                            | 2296 | 2296 |   | 
                                                                                                            
                                                            | 2297 |  | -					$outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --'; | 
                                                                                                            
                                                            |  | 2297 | +					$outarray[-2] = '-- '.$langs->trans("Everybody").' --'; | 
                                                                                                            
                                                            | 2298 | 2298 |  					$outarray2[-2] = array( | 
                                                                                                            
                                                            | 2299 | 2299 |  						'id' => -2, | 
                                                                                                            
                                                            | 2300 |  | -						'label' => '-- ' . $langs->trans("Everybody") . ' --', | 
                                                                                                            
                                                            | 2301 |  | -						'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --', | 
                                                                                                            
                                                            |  | 2300 | +						'label' => '-- '.$langs->trans("Everybody").' --', | 
                                                                                                            
                                                            |  | 2301 | +						'labelhtml' => '-- '.$langs->trans("Everybody").' --', | 
                                                                                                            
                                                            | 2302 | 2302 |  						'color' => '', | 
                                                                                                            
                                                            | 2303 | 2303 |  						'picto' => '' | 
                                                                                                            
                                                            | 2304 | 2304 |  					); | 
                                                                                                                                                        
                                                        |  | @@ -2349,21 +2349,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2349 | 2349 |  					} | 
                                                                                                            
                                                            | 2350 | 2350 |  					if ($showstatus >= 0) { | 
                                                                                                            
                                                            | 2351 | 2351 |  						if ($obj->status == 1 && $showstatus == 1) { | 
                                                                                                            
                                                            | 2352 |  | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); | 
                                                                                                            
                                                            | 2353 |  | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); | 
                                                                                                            
                                                            |  | 2352 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); | 
                                                                                                            
                                                            |  | 2353 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); | 
                                                                                                            
                                                            | 2354 | 2354 |  						} | 
                                                                                                            
                                                            | 2355 | 2355 |  						if ($obj->status == 0 && $showstatus == 1) { | 
                                                                                                            
                                                            | 2356 |  | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); | 
                                                                                                            
                                                            | 2357 |  | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); | 
                                                                                                            
                                                            |  | 2356 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); | 
                                                                                                            
                                                            |  | 2357 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); | 
                                                                                                            
                                                            | 2358 | 2358 |  						} | 
                                                                                                            
                                                            | 2359 | 2359 |  					} | 
                                                                                                            
                                                            | 2360 | 2360 |  					if ($showlabelofentity) { | 
                                                                                                            
                                                            | 2361 | 2361 |  						if (empty($obj->entity)) { | 
                                                                                                            
                                                            | 2362 |  | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); | 
                                                                                                            
                                                            | 2363 |  | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); | 
                                                                                                            
                                                            |  | 2362 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); | 
                                                                                                            
                                                            |  | 2363 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); | 
                                                                                                            
                                                            | 2364 | 2364 |  						} else { | 
                                                                                                            
                                                            | 2365 | 2365 |  							if ($obj->entity != $conf->entity) { | 
                                                                                                            
                                                            | 2366 |  | -								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                                                                            
                                                            |  | 2366 | +								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                                                                            
                                                            | 2367 | 2367 |  								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                                                                            
                                                            | 2368 | 2368 |  							} | 
                                                                                                            
                                                            | 2369 | 2369 |  						} | 
                                                                                                                                                        
                                                        |  | @@ -2372,13 +2372,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2372 | 2372 |  					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); | 
                                                                                                            
                                                            | 2373 | 2373 |  					if (!empty($disableline) && $disableline != '1') { | 
                                                                                                            
                                                            | 2374 | 2374 |  						// Add text from $enableonlytext parameter | 
                                                                                                            
                                                            | 2375 |  | -						$moreinfo .= ' - ' . $disableline; | 
                                                                                                            
                                                            | 2376 |  | -						$moreinfohtml .= ' - ' . $disableline; | 
                                                                                                            
                                                            |  | 2375 | +						$moreinfo .= ' - '.$disableline; | 
                                                                                                            
                                                            |  | 2376 | +						$moreinfohtml .= ' - '.$disableline; | 
                                                                                                            
                                                            | 2377 | 2377 |  					} | 
                                                                                                            
                                                            | 2378 | 2378 |  					$labeltoshow .= $moreinfo; | 
                                                                                                            
                                                            | 2379 | 2379 |  					$labeltoshowhtml .= $moreinfohtml; | 
                                                                                                            
                                                            | 2380 | 2380 |   | 
                                                                                                            
                                                            | 2381 |  | -					$out .= '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 2381 | +					$out .= '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 2382 | 2382 |  					if (!empty($disableline)) { | 
                                                                                                            
                                                            | 2383 | 2383 |  						$out .= ' disabled'; | 
                                                                                                            
                                                            | 2384 | 2384 |  					} | 
                                                                                                                                                        
                                                        |  | @@ -2387,7 +2387,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2387 | 2387 |  					} | 
                                                                                                            
                                                            | 2388 | 2388 |  					$out .= ' data-html="'; | 
                                                                                                            
                                                            | 2389 | 2389 |   | 
                                                                                                            
                                                            | 2390 |  | -					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; | 
                                                                                                            
                                                            |  | 2390 | +					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; | 
                                                                                                            
                                                            | 2391 | 2391 |  					if ($showstatus >= 0 && $obj->status == 0) { | 
                                                                                                            
                                                            | 2392 | 2392 |  						$outhtml .= '<strike class="opacitymediumxxx">'; | 
                                                                                                            
                                                            | 2393 | 2393 |  					} | 
                                                                                                                                                        
                                                        |  | @@ -2402,7 +2402,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2402 | 2402 |  					$out .= $labeltoshow; | 
                                                                                                            
                                                            | 2403 | 2403 |  					$out .= '</option>'; | 
                                                                                                            
                                                            | 2404 | 2404 |   | 
                                                                                                            
                                                            | 2405 |  | -					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; | 
                                                                                                            
                                                            |  | 2405 | +					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; | 
                                                                                                            
                                                            | 2406 | 2406 |  					$outarray2[$userstatic->id] = array( | 
                                                                                                            
                                                            | 2407 | 2407 |  						'id' => $userstatic->id, | 
                                                                                                            
                                                            | 2408 | 2408 |  						'label' => $labeltoshow, | 
                                                                                                                                                        
                                                        |  | @@ -2414,14 +2414,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2414 | 2414 |  					$i++; | 
                                                                                                            
                                                            | 2415 | 2415 |  				} | 
                                                                                                            
                                                            | 2416 | 2416 |  			} else { | 
                                                                                                            
                                                            | 2417 |  | -				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; | 
                                                                                                            
                                                            | 2418 |  | -				$out .= '<option value="">' . $langs->trans("None") . '</option>'; | 
                                                                                                            
                                                            |  | 2417 | +				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; | 
                                                                                                            
                                                            |  | 2418 | +				$out .= '<option value="">'.$langs->trans("None").'</option>'; | 
                                                                                                            
                                                            | 2419 | 2419 |  			} | 
                                                                                                            
                                                            | 2420 | 2420 |  			$out .= '</select>'; | 
                                                                                                            
                                                            | 2421 | 2421 |   | 
                                                                                                            
                                                            | 2422 | 2422 |  			if ($num && !$forcecombo) { | 
                                                                                                            
                                                            | 2423 | 2423 |  				// Enhance with select2 | 
                                                                                                            
                                                            | 2424 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 2424 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 2425 | 2425 |  				$out .= ajax_combobox($htmlname); | 
                                                                                                            
                                                            | 2426 | 2426 |  			} | 
                                                                                                            
                                                            | 2427 | 2427 |  		} else { | 
                                                                                                                                                        
                                                        |  | @@ -2498,7 +2498,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2498 | 2498 |  			$out .= $userstatic->getNomUrl(-1); | 
                                                                                                            
                                                            | 2499 | 2499 |  			if ($i == 0) { | 
                                                                                                            
                                                            | 2500 | 2500 |  				$ownerid = $value['id']; | 
                                                                                                            
                                                            | 2501 |  | -				$out .= ' (' . $langs->trans("Owner") . ')'; | 
                                                                                                            
                                                            |  | 2501 | +				$out .= ' ('.$langs->trans("Owner").')'; | 
                                                                                                            
                                                            | 2502 | 2502 |  			} | 
                                                                                                            
                                                            | 2503 | 2503 |  			// Add picto to delete owner/assignee | 
                                                                                                            
                                                            | 2504 | 2504 |  			if ($nbassignetouser > 1 && $action != 'view') { | 
                                                                                                                                                        
                                                        |  | @@ -2509,7 +2509,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2509 | 2509 |  						$canremoveassignee = 0; | 
                                                                                                            
                                                            | 2510 | 2510 |  					} | 
                                                                                                            
                                                            | 2511 | 2511 |  					if (!$user->hasRight('agenda', 'allactions', 'create')) { | 
                                                                                                            
                                                            | 2512 |  | -						$canremoveassignee = 0;		// Can't remove the owner | 
                                                                                                            
                                                            |  | 2512 | +						$canremoveassignee = 0; // Can't remove the owner | 
                                                                                                            
                                                            | 2513 | 2513 |  					} | 
                                                                                                            
                                                            | 2514 | 2514 |  				} else { | 
                                                                                                            
                                                            | 2515 | 2515 |  					// We are not on the owner of the event but on a secondary assignee | 
                                                                                                                                                        
                                                        |  | @@ -2517,14 +2517,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2517 | 2517 |  				if ($canremoveassignee) { | 
                                                                                                            
                                                            | 2518 | 2518 |  					// If user has all permission, he should be ableto remove a assignee. | 
                                                                                                            
                                                            | 2519 | 2519 |  					// If user has not all permission, he can onlyremove assignee of other (he can't remove itself) | 
                                                                                                            
                                                            | 2520 |  | -					$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 . '">'; | 
                                                                                                            
                                                            |  | 2520 | +					$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.'">'; | 
                                                                                                            
                                                            | 2521 | 2521 |  				} | 
                                                                                                            
                                                            | 2522 | 2522 |  			} | 
                                                                                                            
                                                            | 2523 | 2523 |  			// Show my availability | 
                                                                                                            
                                                            | 2524 | 2524 |  			if ($showproperties) { | 
                                                                                                            
                                                            | 2525 | 2525 |  				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { | 
                                                                                                            
                                                            | 2526 | 2526 |  					$out .= '<div class="myavailability inline-block">'; | 
                                                                                                            
                                                            | 2527 |  | -					$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>'; | 
                                                                                                            
                                                            |  | 2527 | +					$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>'; | 
                                                                                                            
                                                            | 2528 | 2528 |  					$out .= '</div>'; | 
                                                                                                            
                                                            | 2529 | 2529 |  				} | 
                                                                                                            
                                                            | 2530 | 2530 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -2541,15 +2541,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2541 | 2541 |  		// Method with no ajax | 
                                                                                                            
                                                            | 2542 | 2542 |  		if ($action != 'view') { | 
                                                                                                            
                                                            | 2543 | 2543 |  			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; | 
                                                                                                            
                                                            | 2544 |  | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                                                                            
                                                            |  | 2544 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                                                                            
                                                            | 2545 | 2545 |  			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; | 
                                                                                                            
                                                            | 2546 | 2546 |  			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; | 
                                                                                                            
                                                            | 2547 |  | -			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; | 
                                                                                                            
                                                            | 2548 |  | -			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; | 
                                                                                                            
                                                            |  | 2547 | +			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; | 
                                                                                                            
                                                            |  | 2548 | +			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; | 
                                                                                                            
                                                            | 2549 | 2549 |  			$out .= '});'; | 
                                                                                                            
                                                            | 2550 | 2550 |  			$out .= '})</script>'; | 
                                                                                                            
                                                            | 2551 | 2551 |  			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                                                                            
                                                            | 2552 |  | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                                                                            
                                                            |  | 2552 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                                                                            
                                                            | 2553 | 2553 |  			$out .= '<br>'; | 
                                                                                                            
                                                            | 2554 | 2554 |  		} | 
                                                                                                            
                                                            | 2555 | 2555 |   | 
                                                                                                                                                        
                                                        |  | @@ -2608,13 +2608,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2608 | 2608 |  			$resourcestatic->fetch($value['id']); | 
                                                                                                            
                                                            | 2609 | 2609 |  			$out .= $resourcestatic->getNomUrl(-1); | 
                                                                                                            
                                                            | 2610 | 2610 |  			if ($nbassignetoresource >= 1 && $action != 'view') { | 
                                                                                                            
                                                            | 2611 |  | -				$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 . '">'; | 
                                                                                                            
                                                            |  | 2611 | +				$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.'">'; | 
                                                                                                            
                                                            | 2612 | 2612 |  			} | 
                                                                                                            
                                                            | 2613 | 2613 |  			// Show my availability | 
                                                                                                            
                                                            | 2614 | 2614 |  			if ($showproperties) { | 
                                                                                                            
                                                            | 2615 | 2615 |  				if (is_array($listofresourceid) && count($listofresourceid)) { | 
                                                                                                            
                                                            | 2616 | 2616 |  					$out .= '<div class="myavailability inline-block">'; | 
                                                                                                            
                                                            | 2617 |  | -					$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>'; | 
                                                                                                            
                                                            |  | 2617 | +					$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>'; | 
                                                                                                            
                                                            | 2618 | 2618 |  					$out .= '</div>'; | 
                                                                                                            
                                                            | 2619 | 2619 |  				} | 
                                                                                                            
                                                            | 2620 | 2620 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -2631,11 +2631,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2631 | 2631 |  		// Method with no ajax | 
                                                                                                            
                                                            | 2632 | 2632 |  		if ($action != 'view') { | 
                                                                                                            
                                                            | 2633 | 2633 |  			$out .= '<input type="hidden" class="removedassignedresourcehidden" name="removedassignedresource" value="">'; | 
                                                                                                            
                                                            | 2634 |  | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                                                                            
                                                            |  | 2634 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                                                                            
                                                            | 2635 | 2635 |  			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; | 
                                                                                                            
                                                            | 2636 | 2636 |  			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; | 
                                                                                                            
                                                            | 2637 |  | -			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; | 
                                                                                                            
                                                            | 2638 |  | -			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; | 
                                                                                                            
                                                            |  | 2637 | +			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; | 
                                                                                                            
                                                            |  | 2638 | +			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; | 
                                                                                                            
                                                            | 2639 | 2639 |  			$out .= '});'; | 
                                                                                                            
                                                            | 2640 | 2640 |  			$out .= '})</script>'; | 
                                                                                                            
                                                            | 2641 | 2641 |   | 
                                                                                                                                                        
                                                        |  | @@ -2643,7 +2643,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2643 | 2643 |  			$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); | 
                                                                                                            
                                                            | 2644 | 2644 |  			$out .= $formresources->select_resource_list(0, $htmlname, '', 1, 1, 0, $events, '', 2, 0); | 
                                                                                                            
                                                            | 2645 | 2645 |  			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                                                                            
                                                            | 2646 |  | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                                                                            
                                                            |  | 2646 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                                                                            
                                                            | 2647 | 2647 |  			$out .= '<br>'; | 
                                                                                                            
                                                            | 2648 | 2648 |  		} | 
                                                                                                            
                                                            | 2649 | 2649 |   | 
                                                                                                                                                        
                                                        |  | @@ -2706,7 +2706,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2706 | 2706 |  			$placeholder = (is_numeric($showempty) ? '' : 'placeholder="'.dolPrintHTML($showempty).'"'); | 
                                                                                                            
                                                            | 2707 | 2707 |   | 
                                                                                                            
                                                            | 2708 | 2708 |  			if ($selected && empty($selected_input_value)) { | 
                                                                                                            
                                                            | 2709 |  | -				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; | 
                                                                                                            
                                                            |  | 2709 | +				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; | 
                                                                                                            
                                                            | 2710 | 2710 |  				$producttmpselect = new Product($this->db); | 
                                                                                                            
                                                            | 2711 | 2711 |  				$producttmpselect->fetch($selected); | 
                                                                                                            
                                                            | 2712 | 2712 |  				$selected_input_value = $producttmpselect->ref; | 
                                                                                                                                                        
                                                        |  | @@ -2721,9 +2721,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2721 | 2721 |  				} | 
                                                                                                            
                                                            | 2722 | 2722 |  			} | 
                                                                                                            
                                                            | 2723 | 2723 |  			// mode=1 means customers products | 
                                                                                                            
                                                            | 2724 |  | -			$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; | 
                                                                                                            
                                                            |  | 2724 | +			$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; | 
                                                                                                            
                                                            | 2725 | 2725 |  			if ((int) $warehouseId > 0) { | 
                                                                                                            
                                                            | 2726 |  | -				$urloption .= '&warehouseid=' . (int) $warehouseId; | 
                                                                                                            
                                                            |  | 2726 | +				$urloption .= '&warehouseid='.(int) $warehouseId; | 
                                                                                                            
                                                            | 2727 | 2727 |  			} | 
                                                                                                            
                                                            | 2728 | 2728 |   | 
                                                                                                            
                                                            | 2729 | 2729 |  			if (isModEnabled('variants') && is_array($selected_combinations)) { | 
                                                                                                                                                        
                                                        |  | @@ -2731,9 +2731,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2731 | 2731 |  				// when a parent of variant has been selected. | 
                                                                                                            
                                                            | 2732 | 2732 |  				$out .= ' | 
                                                                                                            
                                                            | 2733 | 2733 |  				<!-- script to auto show attributes select tags if a variant was selected --> | 
                                                                                                            
                                                            | 2734 |  | -				<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 2734 | +				<script nonce="' . getNonce().'"> | 
                                                                                                            
                                                            | 2735 | 2735 |  					// auto show attributes fields | 
                                                                                                            
                                                            | 2736 |  | -					selected = ' . json_encode($selected_combinations) . '; | 
                                                                                                            
                                                            |  | 2736 | +					selected = ' . json_encode($selected_combinations).'; | 
                                                                                                            
                                                            | 2737 | 2737 |  					combvalues = {}; | 
                                                                                                            
                                                            | 2738 | 2738 |   | 
                                                                                                            
                                                            | 2739 | 2739 |  					jQuery(document).ready(function () { | 
                                                                                                                                                        
                                                        |  | @@ -2744,7 +2744,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2744 | 2744 |  							} | 
                                                                                                            
                                                            | 2745 | 2745 |  						}); | 
                                                                                                            
                                                            | 2746 | 2746 |   | 
                                                                                                            
                                                            | 2747 |  | -						jQuery("input#' . $htmlname . '").change(function () { | 
                                                                                                            
                                                            |  | 2747 | +						jQuery("input#' . $htmlname.'").change(function () { | 
                                                                                                            
                                                            | 2748 | 2748 |   | 
                                                                                                            
                                                            | 2749 | 2749 |  							if (!jQuery(this).val()) { | 
                                                                                                            
                                                            | 2750 | 2750 |  								jQuery(\'div#attributes_box\').empty(); | 
                                                                                                                                                        
                                                        |  | @@ -2753,7 +2753,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2753 | 2753 |   | 
                                                                                                            
                                                            | 2754 | 2754 |  							console.log("A change has started. We get variants fields to inject html select"); | 
                                                                                                            
                                                            | 2755 | 2755 |   | 
                                                                                                            
                                                            | 2756 |  | -							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { | 
                                                                                                            
                                                            |  | 2756 | +							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { | 
                                                                                                            
                                                            | 2757 | 2757 |  								id: jQuery(this).val() | 
                                                                                                            
                                                            | 2758 | 2758 |  							}, function (data) { | 
                                                                                                            
                                                            | 2759 | 2759 |  								jQuery(\'div#attributes_box\').empty(); | 
                                                                                                                                                        
                                                        |  | @@ -2796,27 +2796,27 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2796 | 2796 |  							}) | 
                                                                                                            
                                                            | 2797 | 2797 |  						}); | 
                                                                                                            
                                                            | 2798 | 2798 |   | 
                                                                                                            
                                                            | 2799 |  | -						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' | 
                                                                                                            
                                                            |  | 2799 | +						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' | 
                                                                                                            
                                                            | 2800 | 2800 |  					}); | 
                                                                                                            
                                                            | 2801 | 2801 |  				</script> | 
                                                                                                            
                                                            | 2802 | 2802 |                  '; | 
                                                                                                            
                                                            | 2803 | 2803 |  			} | 
                                                                                                            
                                                            | 2804 | 2804 |   | 
                                                                                                            
                                                            | 2805 | 2805 |  			if (empty($hidelabel)) { | 
                                                                                                            
                                                            | 2806 |  | -				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; | 
                                                                                                            
                                                            |  | 2806 | +				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"'; | 
                                                                                                            
                                                            | 2807 | 2807 |  			} elseif ($hidelabel > 1) { | 
                                                                                                            
                                                            | 2808 |  | -				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; | 
                                                                                                            
                                                            |  | 2808 | +				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"'; | 
                                                                                                            
                                                            | 2809 | 2809 |  				if ($hidelabel == 2) { | 
                                                                                                            
                                                            | 2810 | 2810 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 2811 | 2811 |  				} | 
                                                                                                            
                                                            | 2812 | 2812 |  			} | 
                                                                                                            
                                                            | 2813 | 2813 |   | 
                                                                                                            
                                                            | 2814 |  | -			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                                                                            
                                                            |  | 2814 | +			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                                                                            
                                                            | 2815 | 2815 |  			if ($hidelabel == 3) { | 
                                                                                                            
                                                            | 2816 | 2816 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 2817 | 2817 |  			} | 
                                                                                                            
                                                            | 2818 | 2818 |   | 
                                                                                                            
                                                            | 2819 |  | -			$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); | 
                                                                                                            
                                                            |  | 2819 | +			$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); | 
                                                                                                            
                                                            | 2820 | 2820 |  		} else { | 
                                                                                                            
                                                            | 2821 | 2821 |  			$out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId); | 
                                                                                                            
                                                            | 2822 | 2822 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -2850,33 +2850,33 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2850 | 2850 |  		// phpcs:enable | 
                                                                                                            
                                                            | 2851 | 2851 |  		global $db; | 
                                                                                                            
                                                            | 2852 | 2852 |   | 
                                                                                                            
                                                            | 2853 |  | -		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; | 
                                                                                                            
                                                            |  | 2853 | +		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; | 
                                                                                                            
                                                            | 2854 | 2854 |   | 
                                                                                                            
                                                            | 2855 | 2855 |  		$error = 0; | 
                                                                                                            
                                                            | 2856 | 2856 |  		$out = ''; | 
                                                                                                            
                                                            | 2857 | 2857 |   | 
                                                                                                            
                                                            | 2858 | 2858 |  		if (!$forcecombo) { | 
                                                                                                            
                                                            | 2859 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 2859 | +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 2860 | 2860 |  			$events = array(); | 
                                                                                                            
                                                            | 2861 | 2861 |  			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                                                                            
                                                            | 2862 | 2862 |  		} | 
                                                                                                            
                                                            | 2863 | 2863 |   | 
                                                                                                            
                                                            | 2864 |  | -		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 2864 | +		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 2865 | 2865 |   | 
                                                                                                            
                                                            | 2866 | 2866 |  		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; | 
                                                                                                            
                                                            | 2867 |  | -		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; | 
                                                                                                            
                                                            | 2868 |  | -		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; | 
                                                                                                            
                                                            |  | 2867 | +		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; | 
                                                                                                            
                                                            |  | 2868 | +		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; | 
                                                                                                            
                                                            | 2869 | 2869 |  		if (!empty($status)) { | 
                                                                                                            
                                                            | 2870 |  | -			$sql .= ' AND status = ' . (int) $status; | 
                                                                                                            
                                                            |  | 2870 | +			$sql .= ' AND status = '.(int) $status; | 
                                                                                                            
                                                            | 2871 | 2871 |  		} | 
                                                                                                            
                                                            | 2872 | 2872 |  		if (!empty($type)) { | 
                                                                                                            
                                                            | 2873 |  | -			$sql .= ' AND bomtype = ' . (int) $type; | 
                                                                                                            
                                                            |  | 2873 | +			$sql .= ' AND bomtype = '.(int) $type; | 
                                                                                                            
                                                            | 2874 | 2874 |  		} | 
                                                                                                            
                                                            | 2875 | 2875 |  		if (!empty($TProducts)) { | 
                                                                                                            
                                                            | 2876 |  | -			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; | 
                                                                                                            
                                                            |  | 2876 | +			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; | 
                                                                                                            
                                                            | 2877 | 2877 |  		} | 
                                                                                                            
                                                            | 2878 | 2878 |  		if (!empty($limit)) { | 
                                                                                                            
                                                            | 2879 |  | -			$sql .= ' LIMIT ' . (int) $limit; | 
                                                                                                            
                                                            |  | 2879 | +			$sql .= ' LIMIT '.(int) $limit; | 
                                                                                                            
                                                            | 2880 | 2880 |  		} | 
                                                                                                            
                                                            | 2881 | 2881 |  		$resql = $db->query($sql); | 
                                                                                                            
                                                            | 2882 | 2882 |  		if ($resql) { | 
                                                                                                                                                        
                                                        |  | @@ -2890,11 +2890,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2890 | 2890 |  			while ($obj = $db->fetch_object($resql)) { | 
                                                                                                            
                                                            | 2891 | 2891 |  				$product = new Product($db); | 
                                                                                                            
                                                            | 2892 | 2892 |  				$res = $product->fetch($obj->fk_product); | 
                                                                                                            
                                                            | 2893 |  | -				$out .= '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 2893 | +				$out .= '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 2894 | 2894 |  				if ($obj->rowid == $selected) { | 
                                                                                                            
                                                            | 2895 | 2895 |  					$out .= 'selected'; | 
                                                                                                            
                                                            | 2896 | 2896 |  				} | 
                                                                                                            
                                                            | 2897 |  | -				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; | 
                                                                                                            
                                                            |  | 2897 | +				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; | 
                                                                                                            
                                                            | 2898 | 2898 |  			} | 
                                                                                                            
                                                            | 2899 | 2899 |  		} else { | 
                                                                                                            
                                                            | 2900 | 2900 |  			$error++; | 
                                                                                                                                                        
                                                        |  | @@ -2952,7 +2952,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2952 | 2952 |   | 
                                                                                                            
                                                            | 2953 | 2953 |  		$warehouseStatusArray = array(); | 
                                                                                                            
                                                            | 2954 | 2954 |  		if (!empty($warehouseStatus)) { | 
                                                                                                            
                                                            | 2955 |  | -			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; | 
                                                                                                            
                                                            |  | 2955 | +			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; | 
                                                                                                            
                                                            | 2956 | 2956 |  			if (preg_match('/warehouseclosed/', $warehouseStatus)) { | 
                                                                                                            
                                                            | 2957 | 2957 |  				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; | 
                                                                                                            
                                                            | 2958 | 2958 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -2966,9 +2966,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2966 | 2966 |   | 
                                                                                                            
                                                            | 2967 | 2967 |  		$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"; | 
                                                                                                            
                                                            | 2968 | 2968 |  		if (count($warehouseStatusArray)) { | 
                                                                                                            
                                                            | 2969 |  | -			$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 | 
                                                                                                            
                                                            |  | 2969 | +			$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 | 
                                                                                                            
                                                            | 2970 | 2970 |  		} else { | 
                                                                                                            
                                                            | 2971 |  | -			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; | 
                                                                                                            
                                                            |  | 2971 | +			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; | 
                                                                                                            
                                                            | 2972 | 2972 |  		} | 
                                                                                                            
                                                            | 2973 | 2973 |   | 
                                                                                                            
                                                            | 2974 | 2974 |  		$sql = "SELECT "; | 
                                                                                                                                                        
                                                        |  | @@ -2984,9 +2984,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 2984 | 2984 |   | 
                                                                                                            
                                                            | 2985 | 2985 |  		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { | 
                                                                                                            
                                                            | 2986 | 2986 |  			//Product category | 
                                                                                                            
                                                            | 2987 |  | -			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie | 
                                                                                                            
                                                            | 2988 |  | -						FROM " . $this->db->prefix() . "categorie_product | 
                                                                                                            
                                                            | 2989 |  | -						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid | 
                                                                                                            
                                                            |  | 2987 | +			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie | 
                                                                                                            
                                                            |  | 2988 | +						FROM " . $this->db->prefix()."categorie_product | 
                                                                                                            
                                                            |  | 2989 | +						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid | 
                                                                                                            
                                                            | 2990 | 2990 |  						LIMIT 1 | 
                                                                                                            
                                                            | 2991 | 2991 |  				) AS categorie_product_id "; | 
                                                                                                            
                                                            | 2992 | 2992 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -3012,15 +3012,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3012 | 3012 |  		} | 
                                                                                                            
                                                            | 3013 | 3013 |  		// Price by quantity | 
                                                                                                            
                                                            | 3014 | 3014 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                                                                            
                                                            | 3015 |  | -			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; | 
                                                                                                            
                                                            |  | 3015 | +			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; | 
                                                                                                            
                                                            | 3016 | 3016 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                                                                            
                                                            | 3017 |  | -				$sql .= " AND price_level = " . ((int) $price_level); | 
                                                                                                            
                                                            |  | 3017 | +				$sql .= " AND price_level = ".((int) $price_level); | 
                                                                                                            
                                                            | 3018 | 3018 |  			} | 
                                                                                                            
                                                            | 3019 | 3019 |  			$sql .= " ORDER BY date_price"; | 
                                                                                                            
                                                            | 3020 | 3020 |  			$sql .= " DESC LIMIT 1) as price_rowid"; | 
                                                                                                            
                                                            | 3021 |  | -			$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 | 
                                                                                                            
                                                            |  | 3021 | +			$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 | 
                                                                                                            
                                                            | 3022 | 3022 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                                                                            
                                                            | 3023 |  | -				$sql .= " AND price_level = " . ((int) $price_level); | 
                                                                                                            
                                                            |  | 3023 | +				$sql .= " AND price_level = ".((int) $price_level); | 
                                                                                                            
                                                            | 3024 | 3024 |  			} | 
                                                                                                            
                                                            | 3025 | 3025 |  			$sql .= " ORDER BY date_price"; | 
                                                                                                            
                                                            | 3026 | 3026 |  			$sql .= " DESC LIMIT 1) as price_by_qty"; | 
                                                                                                                                                        
                                                        |  | @@ -3030,7 +3030,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3030 | 3030 |  		$sql .= " FROM ".$this->db->prefix()."product as p"; | 
                                                                                                            
                                                            | 3031 | 3031 |   | 
                                                                                                            
                                                            | 3032 | 3032 |  		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { | 
                                                                                                            
                                                            | 3033 |  | -			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; | 
                                                                                                            
                                                            |  | 3033 | +			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; | 
                                                                                                            
                                                            | 3034 | 3034 |  		} | 
                                                                                                            
                                                            | 3035 | 3035 |   | 
                                                                                                            
                                                            | 3036 | 3036 |  		// Add from (left join) from hooks | 
                                                                                                                                                        
                                                        |  | @@ -3039,48 +3039,48 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3039 | 3039 |  		$sql .= $hookmanager->resPrint; | 
                                                                                                            
                                                            | 3040 | 3040 |   | 
                                                                                                            
                                                            | 3041 | 3041 |  		if (count($warehouseStatusArray)) { | 
                                                                                                            
                                                            | 3042 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; | 
                                                                                                            
                                                            | 3043 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; | 
                                                                                                            
                                                            | 3044 |  | -			$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. | 
                                                                                                            
                                                            |  | 3042 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; | 
                                                                                                            
                                                            |  | 3043 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; | 
                                                                                                            
                                                            |  | 3044 | +			$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. | 
                                                                                                            
                                                            | 3045 | 3045 |  		} | 
                                                                                                            
                                                            | 3046 | 3046 |   | 
                                                                                                            
                                                            | 3047 | 3047 |  		//Price by customer | 
                                                                                                            
                                                            | 3048 | 3048 |  		if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { | 
                                                                                                            
                                                            | 3049 |  | -			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; | 
                                                                                                            
                                                            |  | 3049 | +			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; | 
                                                                                                            
                                                            | 3050 | 3050 |  		} | 
                                                                                                            
                                                            | 3051 | 3051 |  		// Units | 
                                                                                                            
                                                            | 3052 | 3052 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                                                                            
                                                            | 3053 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; | 
                                                                                                            
                                                            |  | 3053 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; | 
                                                                                                            
                                                            | 3054 | 3054 |  		} | 
                                                                                                            
                                                            | 3055 | 3055 |  		// Multilang : we add translation | 
                                                                                                            
                                                            | 3056 | 3056 |  		if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                                                                            
                                                            | 3057 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; | 
                                                                                                            
                                                            |  | 3057 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; | 
                                                                                                            
                                                            | 3058 | 3058 |  			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { | 
                                                                                                            
                                                            | 3059 |  | -				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; | 
                                                                                                            
                                                            |  | 3059 | +				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; | 
                                                                                                            
                                                            | 3060 | 3060 |  				$soc = new Societe($this->db); | 
                                                                                                            
                                                            | 3061 | 3061 |  				$result = $soc->fetch($socid); | 
                                                                                                            
                                                            | 3062 | 3062 |  				if ($result > 0 && !empty($soc->default_lang)) { | 
                                                                                                            
                                                            | 3063 |  | -					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; | 
                                                                                                            
                                                            |  | 3063 | +					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; | 
                                                                                                            
                                                            | 3064 | 3064 |  				} else { | 
                                                                                                            
                                                            | 3065 |  | -					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; | 
                                                                                                            
                                                            |  | 3065 | +					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; | 
                                                                                                            
                                                            | 3066 | 3066 |  				} | 
                                                                                                            
                                                            | 3067 | 3067 |  			} else { | 
                                                                                                            
                                                            | 3068 |  | -				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; | 
                                                                                                            
                                                            |  | 3068 | +				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; | 
                                                                                                            
                                                            | 3069 | 3069 |  			} | 
                                                                                                            
                                                            | 3070 | 3070 |  		} | 
                                                                                                            
                                                            | 3071 | 3071 |   | 
                                                                                                            
                                                            | 3072 | 3072 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                                                                            
                                                            | 3073 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; | 
                                                                                                            
                                                            |  | 3073 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; | 
                                                                                                            
                                                            | 3074 | 3074 |  		} | 
                                                                                                            
                                                            | 3075 | 3075 |   | 
                                                                                                            
                                                            | 3076 |  | -		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; | 
                                                                                                            
                                                            |  | 3076 | +		$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; | 
                                                                                                            
                                                            | 3077 | 3077 |   | 
                                                                                                            
                                                            | 3078 | 3078 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                                                                            
                                                            | 3079 | 3079 |  			$sql .= " AND pac.rowid IS NULL"; | 
                                                                                                            
                                                            | 3080 | 3080 |  		} | 
                                                                                                            
                                                            | 3081 | 3081 |   | 
                                                                                                            
                                                            | 3082 | 3082 |  		if ($finished == 0) { | 
                                                                                                            
                                                            | 3083 |  | -			$sql .= " AND p.finished = " . ((int) $finished); | 
                                                                                                            
                                                            |  | 3083 | +			$sql .= " AND p.finished = ".((int) $finished); | 
                                                                                                            
                                                            | 3084 | 3084 |  		} elseif ($finished == 1) { | 
                                                                                                            
                                                            | 3085 | 3085 |  			$sql .= " AND p.finished = ".((int) $finished); | 
                                                                                                            
                                                            | 3086 | 3086 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -3088,11 +3088,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3088 | 3088 |  			$sql .= " AND p.tosell = ".((int) $status); | 
                                                                                                            
                                                            | 3089 | 3089 |  		} | 
                                                                                                            
                                                            | 3090 | 3090 |  		if ($status_purchase >= 0) { | 
                                                                                                            
                                                            | 3091 |  | -			$sql .= " AND p.tobuy = " . ((int) $status_purchase); | 
                                                                                                            
                                                            |  | 3091 | +			$sql .= " AND p.tobuy = ".((int) $status_purchase); | 
                                                                                                            
                                                            | 3092 | 3092 |  		} | 
                                                                                                            
                                                            | 3093 | 3093 |  		// Filter by product type | 
                                                                                                            
                                                            | 3094 | 3094 |  		if (strval($filtertype) != '') { | 
                                                                                                            
                                                            | 3095 |  | -			$sql .= " AND p.fk_product_type = " . ((int) $filtertype); | 
                                                                                                            
                                                            |  | 3095 | +			$sql .= " AND p.fk_product_type = ".((int) $filtertype); | 
                                                                                                            
                                                            | 3096 | 3096 |  		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only | 
                                                                                                            
                                                            | 3097 | 3097 |  			$sql .= " AND p.fk_product_type = 1"; | 
                                                                                                            
                                                            | 3098 | 3098 |  		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only | 
                                                                                                                                                        
                                                        |  | @@ -3100,7 +3100,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3100 | 3100 |  		} | 
                                                                                                            
                                                            | 3101 | 3101 |   | 
                                                                                                            
                                                            | 3102 | 3102 |  		if ((int) $warehouseId > 0) { | 
                                                                                                            
                                                            | 3103 |  | -			$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)"; | 
                                                                                                            
                                                            |  | 3103 | +			$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)"; | 
                                                                                                            
                                                            | 3104 | 3104 |  		} | 
                                                                                                            
                                                            | 3105 | 3105 |   | 
                                                                                                            
                                                            | 3106 | 3106 |  		// Add where from hooks | 
                                                                                                                                                        
                                                        |  | @@ -3123,24 +3123,24 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3123 | 3123 |  				if ($i > 0) { | 
                                                                                                            
                                                            | 3124 | 3124 |  					$sql .= " AND "; | 
                                                                                                            
                                                            | 3125 | 3125 |  				} | 
                                                                                                            
                                                            | 3126 |  | -				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3126 | +				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3127 | 3127 |  				if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                                                                            
                                                            | 3128 |  | -					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3128 | +					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3129 | 3129 |  				} | 
                                                                                                            
                                                            | 3130 | 3130 |  				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { | 
                                                                                                            
                                                            | 3131 |  | -					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3131 | +					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3132 | 3132 |  				} | 
                                                                                                            
                                                            | 3133 | 3133 |  				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { | 
                                                                                                            
                                                            | 3134 |  | -					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3134 | +					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3135 | 3135 |  					if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                                                                            
                                                            | 3136 |  | -						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3136 | +						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3137 | 3137 |  					} | 
                                                                                                            
                                                            | 3138 | 3138 |  				} | 
                                                                                                            
                                                            | 3139 | 3139 |   | 
                                                                                                            
                                                            | 3140 | 3140 |  				// include search in supplier ref | 
                                                                                                            
                                                            | 3141 | 3141 |  				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                                                                            
                                                            | 3142 | 3142 |  					$sqlSupplierSearch .= !empty($sqlSupplierSearch) ? ' OR ' : ''; | 
                                                                                                            
                                                            | 3143 |  | -					$sqlSupplierSearch .= " pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3143 | +					$sqlSupplierSearch .= " pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3144 | 3144 |  				} | 
                                                                                                            
                                                            | 3145 | 3145 |  				$sql .= ")"; | 
                                                                                                            
                                                            | 3146 | 3146 |  				$i++; | 
                                                                                                                                                        
                                                        |  | @@ -3149,12 +3149,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3149 | 3149 |  				$sql .= ")"; | 
                                                                                                            
                                                            | 3150 | 3150 |  			} | 
                                                                                                            
                                                            | 3151 | 3151 |  			if (isModEnabled('barcode')) { | 
                                                                                                            
                                                            | 3152 |  | -				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; | 
                                                                                                            
                                                            |  | 3152 | +				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; | 
                                                                                                            
                                                            | 3153 | 3153 |  			} | 
                                                                                                            
                                                            | 3154 | 3154 |   | 
                                                                                                            
                                                            | 3155 | 3155 |  			// include search in supplier ref | 
                                                                                                            
                                                            | 3156 | 3156 |  			if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                                                                            
                                                            | 3157 |  | -				$sql .= " OR EXISTS (SELECT pfp.fk_product FROM " . $this->db->prefix() . "product_fournisseur_price as pfp WHERE p.rowid = pfp.fk_product"; | 
                                                                                                            
                                                            |  | 3157 | +				$sql .= " OR EXISTS (SELECT pfp.fk_product FROM ".$this->db->prefix()."product_fournisseur_price as pfp WHERE p.rowid = pfp.fk_product"; | 
                                                                                                            
                                                            | 3158 | 3158 |  				$sql .= " AND ("; | 
                                                                                                            
                                                            | 3159 | 3159 |  				$sql .= $sqlSupplierSearch; | 
                                                                                                            
                                                            | 3160 | 3160 |  				$sql .= "))"; | 
                                                                                                                                                        
                                                        |  | @@ -3163,7 +3163,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3163 | 3163 |  			$sql .= ')'; | 
                                                                                                            
                                                            | 3164 | 3164 |  		} | 
                                                                                                            
                                                            | 3165 | 3165 |  		if (count($warehouseStatusArray)) { | 
                                                                                                            
                                                            | 3166 |  | -			$sql .= " GROUP BY " . $selectFields; | 
                                                                                                            
                                                            |  | 3166 | +			$sql .= " GROUP BY ".$selectFields; | 
                                                                                                            
                                                            | 3167 | 3167 |  		} | 
                                                                                                            
                                                            | 3168 | 3168 |   | 
                                                                                                            
                                                            | 3169 | 3169 |  		//Sort by category | 
                                                                                                                                                        
                                                        |  | @@ -3178,23 +3178,23 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3178 | 3178 |  		$sql .= $this->db->plimit($limit, 0); | 
                                                                                                            
                                                            | 3179 | 3179 |   | 
                                                                                                            
                                                            | 3180 | 3180 |  		// Build output string | 
                                                                                                            
                                                            | 3181 |  | -		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 3181 | +		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); | 
                                                                                                            
                                                            | 3182 | 3182 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 3183 | 3183 |  		if ($result) { | 
                                                                                                            
                                                            | 3184 |  | -			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; | 
                                                                                                            
                                                            | 3185 |  | -			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            | 3186 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; | 
                                                                                                            
                                                            |  | 3184 | +			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; | 
                                                                                                            
                                                            |  | 3185 | +			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            |  | 3186 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; | 
                                                                                                            
                                                            | 3187 | 3187 |   | 
                                                                                                            
                                                            | 3188 | 3188 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 3189 | 3189 |   | 
                                                                                                            
                                                            | 3190 | 3190 |  			$events = array(); | 
                                                                                                            
                                                            | 3191 | 3191 |   | 
                                                                                                            
                                                            | 3192 | 3192 |  			if (!$forcecombo) { | 
                                                                                                            
                                                            | 3193 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 3193 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 3194 | 3194 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                                                                            
                                                            | 3195 | 3195 |  			} | 
                                                                                                            
                                                            | 3196 | 3196 |   | 
                                                                                                            
                                                            | 3197 |  | -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 3197 | +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 3198 | 3198 |   | 
                                                                                                            
                                                            | 3199 | 3199 |  			$textifempty = ''; | 
                                                                                                            
                                                            | 3200 | 3200 |  			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. | 
                                                                                                                                                        
                                                        |  | @@ -3211,7 +3211,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3211 | 3211 |  				} | 
                                                                                                            
                                                            | 3212 | 3212 |  			} | 
                                                                                                            
                                                            | 3213 | 3213 |  			if ($showempty) { | 
                                                                                                            
                                                            | 3214 |  | -				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; | 
                                                                                                            
                                                            |  | 3214 | +				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; | 
                                                                                                            
                                                            | 3215 | 3215 |  			} | 
                                                                                                            
                                                            | 3216 | 3216 |   | 
                                                                                                            
                                                            | 3217 | 3217 |  			$i = 0; | 
                                                                                                                                                        
                                                        |  | @@ -3222,11 +3222,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3222 | 3222 |   | 
                                                                                                            
                                                            | 3223 | 3223 |  				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 | 
                                                                                                            
                                                            | 3224 | 3224 |  					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; | 
                                                                                                            
                                                            | 3225 |  | -					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; | 
                                                                                                            
                                                            | 3226 |  | -					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); | 
                                                                                                            
                                                            |  | 3225 | +					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; | 
                                                                                                            
                                                            |  | 3226 | +					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); | 
                                                                                                            
                                                            | 3227 | 3227 |  					$sql .= " ORDER BY quantity ASC"; | 
                                                                                                            
                                                            | 3228 | 3228 |   | 
                                                                                                            
                                                            | 3229 |  | -					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 3229 | +					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); | 
                                                                                                            
                                                            | 3230 | 3230 |  					$result2 = $this->db->query($sql); | 
                                                                                                            
                                                            | 3231 | 3231 |  					if ($result2) { | 
                                                                                                            
                                                            | 3232 | 3232 |  						$nb_prices = $this->db->num_rows($result2); | 
                                                                                                                                                        
                                                        |  | @@ -3264,7 +3264,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3264 | 3264 |  						$price_product = new Product($this->db); | 
                                                                                                            
                                                            | 3265 | 3265 |  						$price_product->fetch($objp->rowid, '', '', 1); | 
                                                                                                            
                                                            | 3266 | 3266 |   | 
                                                                                                            
                                                            | 3267 |  | -						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            |  | 3267 | +						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            | 3268 | 3268 |  						$priceparser = new PriceParser($this->db); | 
                                                                                                            
                                                            | 3269 | 3269 |  						$price_result = $priceparser->parseProduct($price_product); | 
                                                                                                            
                                                            | 3270 | 3270 |  						if ($price_result >= 0) { | 
                                                                                                                                                        
                                                        |  | @@ -3350,7 +3350,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3350 | 3350 |  			$label = $objp->label_translated; | 
                                                                                                            
                                                            | 3351 | 3351 |  		} | 
                                                                                                            
                                                            | 3352 | 3352 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                                                                            
                                                            | 3353 |  | -			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                                                                            
                                                            |  | 3353 | +			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                                                                            
                                                            | 3354 | 3354 |  		} | 
                                                                                                            
                                                            | 3355 | 3355 |   | 
                                                                                                            
                                                            | 3356 | 3356 |  		$outkey = $objp->rowid; | 
                                                                                                                                                        
                                                        |  | @@ -3371,32 +3371,32 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3371 | 3371 |  		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; | 
                                                                                                            
                                                            | 3372 | 3372 |   | 
                                                                                                            
                                                            | 3373 | 3373 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                                                                            
                                                            | 3374 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; | 
                                                                                                            
                                                            |  | 3374 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; | 
                                                                                                            
                                                            | 3375 | 3375 |  		} | 
                                                                                                            
                                                            | 3376 | 3376 |   | 
                                                                                                            
                                                            | 3377 | 3377 |  		// Units | 
                                                                                                            
                                                            | 3378 | 3378 |  		$outvalUnits = ''; | 
                                                                                                            
                                                            | 3379 | 3379 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                                                                            
                                                            | 3380 | 3380 |  			if (!empty($objp->unit_short)) { | 
                                                                                                            
                                                            | 3381 |  | -				$outvalUnits .= ' - ' . $objp->unit_short; | 
                                                                                                            
                                                            |  | 3381 | +				$outvalUnits .= ' - '.$objp->unit_short; | 
                                                                                                            
                                                            | 3382 | 3382 |  			} | 
                                                                                                            
                                                            | 3383 | 3383 |  		} | 
                                                                                                            
                                                            | 3384 | 3384 |  		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { | 
                                                                                                            
                                                            | 3385 | 3385 |  			if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                                                                            
                                                            | 3386 | 3386 |  				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); | 
                                                                                                            
                                                            | 3387 |  | -				$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3387 | +				$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3388 | 3388 |  			} | 
                                                                                                            
                                                            | 3389 | 3389 |  			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                                                                            
                                                            | 3390 |  | -				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); | 
                                                                                                            
                                                            | 3391 |  | -				$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3390 | +				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); | 
                                                                                                            
                                                            |  | 3391 | +				$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3392 | 3392 |  			} | 
                                                                                                            
                                                            | 3393 | 3393 |  			if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                                                                            
                                                            | 3394 | 3394 |  				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); | 
                                                                                                            
                                                            | 3395 |  | -				$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3395 | +				$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3396 | 3396 |  			} | 
                                                                                                            
                                                            | 3397 | 3397 |  			if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                                                                            
                                                            | 3398 | 3398 |  				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); | 
                                                                                                            
                                                            | 3399 |  | -				$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3399 | +				$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3400 | 3400 |  			} | 
                                                                                                            
                                                            | 3401 | 3401 |  		} | 
                                                                                                            
                                                            | 3402 | 3402 |  		if ($outdurationvalue && $outdurationunit) { | 
                                                                                                                                                        
                                                        |  | @@ -3408,7 +3408,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3408 | 3408 |  				'y' => $langs->trans('Year') | 
                                                                                                            
                                                            | 3409 | 3409 |  			); | 
                                                                                                            
                                                            | 3410 | 3410 |  			if (isset($da[$outdurationunit])) { | 
                                                                                                            
                                                            | 3411 |  | -				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); | 
                                                                                                            
                                                            |  | 3411 | +				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); | 
                                                                                                            
                                                            | 3412 | 3412 |  			} | 
                                                                                                            
                                                            | 3413 | 3413 |  		} | 
                                                                                                            
                                                            | 3414 | 3414 |   | 
                                                                                                                                                        
                                                        |  | @@ -3428,31 +3428,31 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3428 | 3428 |  		$labeltoshow = ''; | 
                                                                                                            
                                                            | 3429 | 3429 |  		$labeltoshow .= $objp->ref; | 
                                                                                                            
                                                            | 3430 | 3430 |  		if (!empty($objp->custref)) { | 
                                                                                                            
                                                            | 3431 |  | -			$labeltoshow .= ' (' . $objp->custref . ')'; | 
                                                                                                            
                                                            |  | 3431 | +			$labeltoshow .= ' ('.$objp->custref.')'; | 
                                                                                                            
                                                            | 3432 | 3432 |  		} | 
                                                                                                            
                                                            | 3433 | 3433 |  		if ($outbarcode) { | 
                                                                                                            
                                                            | 3434 |  | -			$labeltoshow .= ' (' . $outbarcode . ')'; | 
                                                                                                            
                                                            |  | 3434 | +			$labeltoshow .= ' ('.$outbarcode.')'; | 
                                                                                                            
                                                            | 3435 | 3435 |  		} | 
                                                                                                            
                                                            | 3436 |  | -		$labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            |  | 3436 | +		$labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            | 3437 | 3437 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                                                                            
                                                            | 3438 |  | -			$labeltoshow .= ' (' . getCountry($outorigin, '1') . ')'; | 
                                                                                                            
                                                            |  | 3438 | +			$labeltoshow .= ' ('.getCountry($outorigin, '1').')'; | 
                                                                                                            
                                                            | 3439 | 3439 |  		} | 
                                                                                                            
                                                            | 3440 | 3440 |   | 
                                                                                                            
                                                            | 3441 | 3441 |  		// Set $labltoshowhtml | 
                                                                                                            
                                                            | 3442 | 3442 |  		$labeltoshowhtml = ''; | 
                                                                                                            
                                                            | 3443 | 3443 |  		$labeltoshowhtml .= $objp->ref; | 
                                                                                                            
                                                            | 3444 | 3444 |  		if (!empty($objp->custref)) { | 
                                                                                                            
                                                            | 3445 |  | -			$labeltoshowhtml .= ' (' . $objp->custref . ')'; | 
                                                                                                            
                                                            |  | 3445 | +			$labeltoshowhtml .= ' ('.$objp->custref.')'; | 
                                                                                                            
                                                            | 3446 | 3446 |  		} | 
                                                                                                            
                                                            | 3447 | 3447 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                                                                            
                                                            | 3448 |  | -			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); | 
                                                                                                            
                                                            |  | 3448 | +			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); | 
                                                                                                            
                                                            | 3449 | 3449 |  		} | 
                                                                                                            
                                                            | 3450 | 3450 |  		if ($outbarcode) { | 
                                                                                                            
                                                            | 3451 |  | -			$labeltoshowhtml .= ' (' . $outbarcode . ')'; | 
                                                                                                            
                                                            |  | 3451 | +			$labeltoshowhtml .= ' ('.$outbarcode.')'; | 
                                                                                                            
                                                            | 3452 | 3452 |  		} | 
                                                                                                            
                                                            | 3453 |  | -		$labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            |  | 3453 | +		$labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            | 3454 | 3454 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                                                                            
                                                            | 3455 |  | -			$labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')'; | 
                                                                                                            
                                                            |  | 3455 | +			$labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')'; | 
                                                                                                            
                                                            | 3456 | 3456 |  		} | 
                                                                                                            
                                                            | 3457 | 3457 |   | 
                                                                                                            
                                                            | 3458 | 3458 |  		// Stock | 
                                                                                                                                                        
                                                        |  | @@ -3460,14 +3460,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3460 | 3460 |  		$labeltoshowhtmlstock = ''; | 
                                                                                                            
                                                            | 3461 | 3461 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                                                                            
                                                            | 3462 | 3462 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                                                                            
                                                            | 3463 |  | -				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); | 
                                                                                                            
                                                            |  | 3463 | +				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); | 
                                                                                                            
                                                            | 3464 | 3464 |   | 
                                                                                                            
                                                            | 3465 | 3465 |  				if ($objp->stock > 0) { | 
                                                                                                            
                                                            | 3466 | 3466 |  					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; | 
                                                                                                            
                                                            | 3467 | 3467 |  				} elseif ($objp->stock <= 0) { | 
                                                                                                            
                                                            | 3468 | 3468 |  					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; | 
                                                                                                            
                                                            | 3469 | 3469 |  				} | 
                                                                                                            
                                                            | 3470 |  | -				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); | 
                                                                                                            
                                                            |  | 3470 | +				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); | 
                                                                                                            
                                                            | 3471 | 3471 |  				$labeltoshowhtmlstock .= '</span>'; | 
                                                                                                            
                                                            | 3472 | 3472 |   | 
                                                                                                            
                                                            | 3473 | 3473 |  				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                                                                                                                        
                                                        |  | @@ -3478,9 +3478,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3478 | 3478 |  					$tmpproduct->load_virtual_stock(); | 
                                                                                                            
                                                            | 3479 | 3479 |  					$virtualstock = $tmpproduct->stock_theorique; | 
                                                                                                            
                                                            | 3480 | 3480 |   | 
                                                                                                            
                                                            | 3481 |  | -					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                                                                            
                                                            |  | 3481 | +					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                                                                            
                                                            | 3482 | 3482 |   | 
                                                                                                            
                                                            | 3483 |  | -					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                                                                            
                                                            |  | 3483 | +					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                                                                            
                                                            | 3484 | 3484 |  					if ($virtualstock > 0) { | 
                                                                                                            
                                                            | 3485 | 3485 |  						$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; | 
                                                                                                            
                                                            | 3486 | 3486 |  					} elseif ($virtualstock <= 0) { | 
                                                                                                                                                        
                                                        |  | @@ -3501,35 +3501,35 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3501 | 3501 |  		// If we need a particular price level (from 1 to n) | 
                                                                                                            
                                                            | 3502 | 3502 |  		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { | 
                                                                                                            
                                                            | 3503 | 3503 |  			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; | 
                                                                                                            
                                                            | 3504 |  | -			$sql .= " FROM " . $this->db->prefix() . "product_price"; | 
                                                                                                            
                                                            | 3505 |  | -			$sql .= " WHERE fk_product = " . ((int) $objp->rowid); | 
                                                                                                            
                                                            | 3506 |  | -			$sql .= " AND entity IN (" . getEntity('productprice') . ")"; | 
                                                                                                            
                                                            | 3507 |  | -			$sql .= " AND price_level = " . ((int) $price_level); | 
                                                                                                            
                                                            |  | 3504 | +			$sql .= " FROM ".$this->db->prefix()."product_price"; | 
                                                                                                            
                                                            |  | 3505 | +			$sql .= " WHERE fk_product = ".((int) $objp->rowid); | 
                                                                                                            
                                                            |  | 3506 | +			$sql .= " AND entity IN (".getEntity('productprice').")"; | 
                                                                                                            
                                                            |  | 3507 | +			$sql .= " AND price_level = ".((int) $price_level); | 
                                                                                                            
                                                            | 3508 | 3508 |  			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. | 
                                                                                                            
                                                            | 3509 | 3509 |  			$sql .= " LIMIT 1"; | 
                                                                                                            
                                                            | 3510 | 3510 |   | 
                                                                                                            
                                                            | 3511 |  | -			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 3511 | +			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); | 
                                                                                                            
                                                            | 3512 | 3512 |  			$result2 = $this->db->query($sql); | 
                                                                                                            
                                                            | 3513 | 3513 |  			if ($result2) { | 
                                                                                                            
                                                            | 3514 | 3514 |  				$objp2 = $this->db->fetch_object($result2); | 
                                                                                                            
                                                            | 3515 | 3515 |  				if ($objp2) { | 
                                                                                                            
                                                            | 3516 | 3516 |  					$found = 1; | 
                                                                                                            
                                                            | 3517 | 3517 |  					if ($objp2->price_base_type == 'HT') { | 
                                                                                                            
                                                            | 3518 |  | -						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                                                                            
                                                            | 3519 |  | -						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                                                                            
                                                            |  | 3518 | +						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                                                                            
                                                            |  | 3519 | +						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                                                                            
                                                            | 3520 | 3520 |  					} else { | 
                                                                                                            
                                                            | 3521 |  | -						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                                                                            
                                                            | 3522 |  | -						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                                                                            
                                                            |  | 3521 | +						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                                                                            
                                                            |  | 3522 | +						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                                                                            
                                                            | 3523 | 3523 |  					} | 
                                                                                                            
                                                            | 3524 | 3524 |  					$outprice_ht = price($objp2->price); | 
                                                                                                            
                                                            | 3525 | 3525 |  					$outprice_ttc = price($objp2->price_ttc); | 
                                                                                                            
                                                            | 3526 | 3526 |  					$outpricebasetype = $objp2->price_base_type; | 
                                                                                                            
                                                            | 3527 | 3527 |  					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility | 
                                                                                                            
                                                            | 3528 |  | -						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice | 
                                                                                                            
                                                            | 3529 |  | -						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice | 
                                                                                                            
                                                            |  | 3528 | +						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice | 
                                                                                                            
                                                            |  | 3529 | +						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice | 
                                                                                                            
                                                            | 3530 | 3530 |  					} else { | 
                                                                                                            
                                                            | 3531 |  | -						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice | 
                                                                                                            
                                                            | 3532 |  | -						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice | 
                                                                                                            
                                                            |  | 3531 | +						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice | 
                                                                                                            
                                                            |  | 3532 | +						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice | 
                                                                                                            
                                                            | 3533 | 3533 |  					} | 
                                                                                                            
                                                            | 3534 | 3534 |  				} | 
                                                                                                            
                                                            | 3535 | 3535 |  			} else { | 
                                                                                                                                                        
                                                        |  | @@ -3543,13 +3543,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3543 | 3543 |  			$outqty = $objp->quantity; | 
                                                                                                            
                                                            | 3544 | 3544 |  			$outdiscount = $objp->remise_percent; | 
                                                                                                            
                                                            | 3545 | 3545 |  			if ($objp->quantity == 1) { | 
                                                                                                            
                                                            | 3546 |  | -				$labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                                                                            
                                                            | 3547 |  | -				$labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                                                                            
                                                            |  | 3546 | +				$labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                                                                            
                                                            |  | 3547 | +				$labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                                                                            
                                                            | 3548 | 3548 |  				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            | 3549 | 3549 |  				$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); | 
                                                                                                            
                                                            | 3550 | 3550 |  			} else { | 
                                                                                                            
                                                            | 3551 |  | -				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                                                                            
                                                            | 3552 |  | -				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                                                                            
                                                            |  | 3551 | +				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                                                                            
                                                            |  | 3552 | +				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                                                                            
                                                            | 3553 | 3553 |  				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            | 3554 | 3554 |  				$labeltoshowhtmlprice .= $langs->transnoentities("Units"); | 
                                                                                                            
                                                            | 3555 | 3555 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -3557,16 +3557,16 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3557 | 3557 |  			$outprice_ht = price($objp->unitprice); | 
                                                                                                            
                                                            | 3558 | 3558 |  			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); | 
                                                                                                            
                                                            | 3559 | 3559 |  			$outpricebasetype = $objp->price_base_type; | 
                                                                                                            
                                                            | 3560 |  | -			$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 | 
                                                                                                            
                                                            | 3561 |  | -			$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 | 
                                                                                                            
                                                            |  | 3560 | +			$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 | 
                                                                                                            
                                                            |  | 3561 | +			$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 | 
                                                                                                            
                                                            | 3562 | 3562 |  		} | 
                                                                                                            
                                                            | 3563 | 3563 |  		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { | 
                                                                                                            
                                                            | 3564 |  | -			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            | 3565 |  | -			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            |  | 3564 | +			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            |  | 3565 | +			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            | 3566 | 3566 |  		} | 
                                                                                                            
                                                            | 3567 | 3567 |  		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { | 
                                                                                                            
                                                            | 3568 |  | -			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                                                                            
                                                            | 3569 |  | -			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                                                                            
                                                            |  | 3568 | +			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                                                                            
                                                            |  | 3569 | +			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                                                                            
                                                            | 3570 | 3570 |  		} | 
                                                                                                            
                                                            | 3571 | 3571 |   | 
                                                                                                            
                                                            | 3572 | 3572 |  		// Price by customer | 
                                                                                                                                                        
                                                        |  | @@ -3575,11 +3575,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3575 | 3575 |  				$found = 1; | 
                                                                                                            
                                                            | 3576 | 3576 |   | 
                                                                                                            
                                                            | 3577 | 3577 |  				if ($objp->custprice_base_type == 'HT') { | 
                                                                                                            
                                                            | 3578 |  | -					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                                                                            
                                                            | 3579 |  | -					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                                                                            
                                                            |  | 3578 | +					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                                                                            
                                                            |  | 3579 | +					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                                                                            
                                                            | 3580 | 3580 |  				} else { | 
                                                                                                            
                                                            | 3581 |  | -					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                                                                            
                                                            | 3582 |  | -					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                                                                            
                                                            |  | 3581 | +					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                                                                            
                                                            |  | 3582 | +					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                                                                            
                                                            | 3583 | 3583 |  				} | 
                                                                                                            
                                                            | 3584 | 3584 |   | 
                                                                                                            
                                                            | 3585 | 3585 |  				$outprice_ht = price($objp->custprice); | 
                                                                                                                                                        
                                                        |  | @@ -3593,11 +3593,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3593 | 3593 |  		// If level no defined or multiprice not found, we used the default price | 
                                                                                                            
                                                            | 3594 | 3594 |  		if (empty($hidepriceinlabel) && !$found) { | 
                                                                                                            
                                                            | 3595 | 3595 |  			if ($objp->price_base_type == 'HT') { | 
                                                                                                            
                                                            | 3596 |  | -				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                                                                            
                                                            | 3597 |  | -				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                                                                            
                                                            |  | 3596 | +				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                                                                            
                                                            |  | 3597 | +				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                                                                            
                                                            | 3598 | 3598 |  			} else { | 
                                                                                                            
                                                            | 3599 |  | -				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                                                                            
                                                            | 3600 |  | -				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                                                                            
                                                            |  | 3599 | +				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                                                                            
                                                            |  | 3600 | +				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                                                                            
                                                            | 3601 | 3601 |  			} | 
                                                                                                            
                                                            | 3602 | 3602 |  			$outprice_ht = price($objp->price); | 
                                                                                                            
                                                            | 3603 | 3603 |  			$outprice_ttc = price($objp->price_ttc); | 
                                                                                                                                                        
                                                        |  | @@ -3607,14 +3607,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3607 | 3607 |  		} | 
                                                                                                            
                                                            | 3608 | 3608 |   | 
                                                                                                            
                                                            | 3609 | 3609 |  		// Build options | 
                                                                                                            
                                                            | 3610 |  | -		$opt = '<option value="' . $objp->rowid . '"'; | 
                                                                                                            
                                                            |  | 3610 | +		$opt = '<option value="'.$objp->rowid.'"'; | 
                                                                                                            
                                                            | 3611 | 3611 |  		$opt .= ($objp->rowid == $selected) ? ' selected' : ''; | 
                                                                                                            
                                                            | 3612 | 3612 |  		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { | 
                                                                                                            
                                                            | 3613 |  | -			$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 . '"'; | 
                                                                                                            
                                                            |  | 3613 | +			$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.'"'; | 
                                                                                                            
                                                            | 3614 | 3614 |  		} | 
                                                                                                            
                                                            | 3615 | 3615 |  		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { | 
                                                                                                            
                                                            | 3616 |  | -			$opt .= ' data-labeltrans="' . $outlabel_translated . '"'; | 
                                                                                                            
                                                            | 3617 |  | -			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; | 
                                                                                                            
                                                            |  | 3616 | +			$opt .= ' data-labeltrans="'.$outlabel_translated.'"'; | 
                                                                                                            
                                                            |  | 3617 | +			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; | 
                                                                                                            
                                                            | 3618 | 3618 |  		} | 
                                                                                                            
                                                            | 3619 | 3619 |   | 
                                                                                                            
                                                            | 3620 | 3620 |  		if ($stocktag == 1) { | 
                                                                                                                                                        
                                                        |  | @@ -3709,7 +3709,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3709 | 3709 |  		$selected_input_value = ''; | 
                                                                                                            
                                                            | 3710 | 3710 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { | 
                                                                                                            
                                                            | 3711 | 3711 |  			if ($selected > 0) { | 
                                                                                                            
                                                            | 3712 |  | -				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; | 
                                                                                                            
                                                            |  | 3712 | +				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; | 
                                                                                                            
                                                            | 3713 | 3713 |  				$producttmpselect = new Product($this->db); | 
                                                                                                            
                                                            | 3714 | 3714 |  				$producttmpselect->fetch($selected); | 
                                                                                                            
                                                            | 3715 | 3715 |  				$selected_input_value = $producttmpselect->ref; | 
                                                                                                                                                        
                                                        |  | @@ -3717,10 +3717,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3717 | 3717 |  			} | 
                                                                                                            
                                                            | 3718 | 3718 |   | 
                                                                                                            
                                                            | 3719 | 3719 |  			// mode=2 means suppliers products | 
                                                                                                            
                                                            | 3720 |  | -			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; | 
                                                                                                            
                                                            | 3721 |  | -			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); | 
                                                                                                            
                                                            |  | 3720 | +			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; | 
                                                                                                            
                                                            |  | 3721 | +			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); | 
                                                                                                            
                                                            | 3722 | 3722 |   | 
                                                                                                            
                                                            | 3723 |  | -			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; | 
                                                                                                            
                                                            |  | 3723 | +			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; | 
                                                                                                            
                                                            | 3724 | 3724 |  		} else { | 
                                                                                                            
                                                            | 3725 | 3725 |  			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); | 
                                                                                                            
                                                            | 3726 | 3726 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -3778,25 +3778,25 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3778 | 3778 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                                                                            
                                                            | 3779 | 3779 |  			$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"; | 
                                                                                                            
                                                            | 3780 | 3780 |  		} | 
                                                                                                            
                                                            | 3781 |  | -		$sql .= " FROM " . $this->db->prefix() . "product as p"; | 
                                                                                                            
                                                            | 3782 |  | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; | 
                                                                                                            
                                                            |  | 3781 | +		$sql .= " FROM ".$this->db->prefix()."product as p"; | 
                                                                                                            
                                                            |  | 3782 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; | 
                                                                                                            
                                                            | 3783 | 3783 |  		if ($socid > 0) { | 
                                                                                                            
                                                            | 3784 |  | -			$sql .= " AND pfp.fk_soc = " . ((int) $socid); | 
                                                                                                            
                                                            |  | 3784 | +			$sql .= " AND pfp.fk_soc = ".((int) $socid); | 
                                                                                                            
                                                            | 3785 | 3785 |  		} | 
                                                                                                            
                                                            | 3786 |  | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; | 
                                                                                                            
                                                            |  | 3786 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; | 
                                                                                                            
                                                            | 3787 | 3787 |  		// Units | 
                                                                                                            
                                                            | 3788 | 3788 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                                                                            
                                                            | 3789 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; | 
                                                                                                            
                                                            |  | 3789 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; | 
                                                                                                            
                                                            | 3790 | 3790 |  		} | 
                                                                                                            
                                                            | 3791 |  | -		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; | 
                                                                                                            
                                                            |  | 3791 | +		$sql .= " WHERE p.entity IN (".getEntity('product').")"; | 
                                                                                                            
                                                            | 3792 | 3792 |  		if ($statut != -1) { | 
                                                                                                            
                                                            | 3793 |  | -			$sql .= " AND p.tobuy = " . ((int) $statut); | 
                                                                                                            
                                                            |  | 3793 | +			$sql .= " AND p.tobuy = ".((int) $statut); | 
                                                                                                            
                                                            | 3794 | 3794 |  		} | 
                                                                                                            
                                                            | 3795 | 3795 |  		if (strval($filtertype) != '') { | 
                                                                                                            
                                                            | 3796 |  | -			$sql .= " AND p.fk_product_type = " . ((int) $filtertype); | 
                                                                                                            
                                                            |  | 3796 | +			$sql .= " AND p.fk_product_type = ".((int) $filtertype); | 
                                                                                                            
                                                            | 3797 | 3797 |  		} | 
                                                                                                            
                                                            | 3798 | 3798 |  		if (!empty($filtre)) { | 
                                                                                                            
                                                            | 3799 |  | -			$sql .= " " . $filtre; | 
                                                                                                            
                                                            |  | 3799 | +			$sql .= " ".$filtre; | 
                                                                                                            
                                                            | 3800 | 3800 |  		} | 
                                                                                                            
                                                            | 3801 | 3801 |  		// Add where from hooks | 
                                                                                                            
                                                            | 3802 | 3802 |  		$parameters = array(); | 
                                                                                                                                                        
                                                        |  | @@ -3816,9 +3816,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3816 | 3816 |  				if ($i > 0) { | 
                                                                                                            
                                                            | 3817 | 3817 |  					$sql .= " AND "; | 
                                                                                                            
                                                            | 3818 | 3818 |  				} | 
                                                                                                            
                                                            | 3819 |  | -				$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) . "%'"; | 
                                                                                                            
                                                            |  | 3819 | +				$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)."%'"; | 
                                                                                                            
                                                            | 3820 | 3820 |  				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { | 
                                                                                                            
                                                            | 3821 |  | -					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 3821 | +					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 3822 | 3822 |  				} | 
                                                                                                            
                                                            | 3823 | 3823 |  				$sql .= ")"; | 
                                                                                                            
                                                            | 3824 | 3824 |  				$i++; | 
                                                                                                                                                        
                                                        |  | @@ -3827,8 +3827,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3827 | 3827 |  				$sql .= ")"; | 
                                                                                                            
                                                            | 3828 | 3828 |  			} | 
                                                                                                            
                                                            | 3829 | 3829 |  			if (isModEnabled('barcode')) { | 
                                                                                                            
                                                            | 3830 |  | -				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; | 
                                                                                                            
                                                            | 3831 |  | -				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; | 
                                                                                                            
                                                            |  | 3830 | +				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; | 
                                                                                                            
                                                            |  | 3831 | +				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; | 
                                                                                                            
                                                            | 3832 | 3832 |  			} | 
                                                                                                            
                                                            | 3833 | 3833 |  			$sql .= ')'; | 
                                                                                                            
                                                            | 3834 | 3834 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -3837,20 +3837,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3837 | 3837 |   | 
                                                                                                            
                                                            | 3838 | 3838 |  		// Build output string | 
                                                                                                            
                                                            | 3839 | 3839 |   | 
                                                                                                            
                                                            | 3840 |  | -		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 3840 | +		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); | 
                                                                                                            
                                                            | 3841 | 3841 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 3842 | 3842 |  		if ($result) { | 
                                                                                                            
                                                            | 3843 |  | -			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            | 3844 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; | 
                                                                                                            
                                                            |  | 3843 | +			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            |  | 3844 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; | 
                                                                                                            
                                                            | 3845 | 3845 |   | 
                                                                                                            
                                                            | 3846 | 3846 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 3847 | 3847 |   | 
                                                                                                            
                                                            | 3848 | 3848 |  			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax | 
                                                                                                            
                                                            | 3849 |  | -			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 3849 | +			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 3850 | 3850 |  			if (!$selected) { | 
                                                                                                            
                                                            | 3851 |  | -				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; | 
                                                                                                            
                                                            |  | 3851 | +				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; | 
                                                                                                            
                                                            | 3852 | 3852 |  			} else { | 
                                                                                                            
                                                            | 3853 |  | -				$out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; | 
                                                                                                            
                                                            |  | 3853 | +				$out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; | 
                                                                                                            
                                                            | 3854 | 3854 |  			} | 
                                                                                                            
                                                            | 3855 | 3855 |   | 
                                                                                                            
                                                            | 3856 | 3856 |  			$i = 0; | 
                                                                                                                                                        
                                                        |  | @@ -3865,7 +3865,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3865 | 3865 |   | 
                                                                                                            
                                                            | 3866 | 3866 |  				$outkey = $objp->idprodfournprice; // id in table of price | 
                                                                                                            
                                                            | 3867 | 3867 |  				if (!$outkey && $alsoproductwithnosupplierprice) { | 
                                                                                                            
                                                            | 3868 |  | -					$outkey = 'idprod_' . $objp->rowid; // id of product | 
                                                                                                            
                                                            |  | 3868 | +					$outkey = 'idprod_'.$objp->rowid; // id of product | 
                                                                                                            
                                                            | 3869 | 3869 |  				} | 
                                                                                                            
                                                            | 3870 | 3870 |   | 
                                                                                                            
                                                            | 3871 | 3871 |  				$outref = $objp->ref; | 
                                                                                                                                                        
                                                        |  | @@ -3880,23 +3880,23 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3880 | 3880 |  				$outvalUnits = ''; | 
                                                                                                            
                                                            | 3881 | 3881 |  				if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                                                                            
                                                            | 3882 | 3882 |  					if (!empty($objp->unit_short)) { | 
                                                                                                            
                                                            | 3883 |  | -						$outvalUnits .= ' - ' . $objp->unit_short; | 
                                                                                                            
                                                            |  | 3883 | +						$outvalUnits .= ' - '.$objp->unit_short; | 
                                                                                                            
                                                            | 3884 | 3884 |  					} | 
                                                                                                            
                                                            | 3885 | 3885 |  					if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                                                                            
                                                            | 3886 | 3886 |  						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); | 
                                                                                                            
                                                            | 3887 |  | -						$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3887 | +						$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3888 | 3888 |  					} | 
                                                                                                            
                                                            | 3889 | 3889 |  					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                                                                            
                                                            | 3890 |  | -						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); | 
                                                                                                            
                                                            | 3891 |  | -						$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3890 | +						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); | 
                                                                                                            
                                                            |  | 3891 | +						$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3892 | 3892 |  					} | 
                                                                                                            
                                                            | 3893 | 3893 |  					if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                                                                            
                                                            | 3894 | 3894 |  						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); | 
                                                                                                            
                                                            | 3895 |  | -						$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3895 | +						$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3896 | 3896 |  					} | 
                                                                                                            
                                                            | 3897 | 3897 |  					if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                                                                            
                                                            | 3898 | 3898 |  						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); | 
                                                                                                            
                                                            | 3899 |  | -						$outvalUnits .= ' - ' . $unitToShow; | 
                                                                                                            
                                                            |  | 3899 | +						$outvalUnits .= ' - '.$unitToShow; | 
                                                                                                            
                                                            | 3900 | 3900 |  					} | 
                                                                                                            
                                                            | 3901 | 3901 |  					if ($outdurationvalue && $outdurationunit) { | 
                                                                                                            
                                                            | 3902 | 3902 |  						$da = array( | 
                                                                                                                                                        
                                                        |  | @@ -3907,22 +3907,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3907 | 3907 |  							'y' => $langs->trans('Year') | 
                                                                                                            
                                                            | 3908 | 3908 |  						); | 
                                                                                                            
                                                            | 3909 | 3909 |  						if (isset($da[$outdurationunit])) { | 
                                                                                                            
                                                            | 3910 |  | -							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); | 
                                                                                                            
                                                            |  | 3910 | +							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); | 
                                                                                                            
                                                            | 3911 | 3911 |  						} | 
                                                                                                            
                                                            | 3912 | 3912 |  					} | 
                                                                                                            
                                                            | 3913 | 3913 |  				} | 
                                                                                                            
                                                            | 3914 | 3914 |   | 
                                                                                                            
                                                            | 3915 | 3915 |  				$objRef = $objp->ref; | 
                                                                                                            
                                                            | 3916 | 3916 |  				if ($filterkey && $filterkey != '') { | 
                                                                                                            
                                                            | 3917 |  | -					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                                                                            
                                                            |  | 3917 | +					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                                                                            
                                                            | 3918 | 3918 |  				} | 
                                                                                                            
                                                            | 3919 | 3919 |  				$objRefFourn = $objp->ref_fourn; | 
                                                                                                            
                                                            | 3920 | 3920 |  				if ($filterkey && $filterkey != '') { | 
                                                                                                            
                                                            | 3921 |  | -					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                                                                            
                                                            |  | 3921 | +					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                                                                            
                                                            | 3922 | 3922 |  				} | 
                                                                                                            
                                                            | 3923 | 3923 |  				$label = $objp->label; | 
                                                                                                            
                                                            | 3924 | 3924 |  				if ($filterkey && $filterkey != '') { | 
                                                                                                            
                                                            | 3925 |  | -					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                                                                            
                                                            |  | 3925 | +					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                                                                            
                                                            | 3926 | 3926 |  				} | 
                                                                                                            
                                                            | 3927 | 3927 |   | 
                                                                                                            
                                                            | 3928 | 3928 |  				switch ($objp->fk_product_type) { | 
                                                                                                                                                        
                                                        |  | @@ -3945,21 +3945,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3945 | 3945 |   | 
                                                                                                            
                                                            | 3946 | 3946 |  				$optlabel .= $objp->ref; | 
                                                                                                            
                                                            | 3947 | 3947 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                                                                            
                                                            | 3948 |  | -					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; | 
                                                                                                            
                                                            |  | 3948 | +					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; | 
                                                                                                            
                                                            | 3949 | 3949 |  				} | 
                                                                                                            
                                                            | 3950 | 3950 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                                                                            
                                                            | 3951 |  | -					$optlabel .= ' (' . $outbarcode . ')'; | 
                                                                                                            
                                                            |  | 3951 | +					$optlabel .= ' ('.$outbarcode.')'; | 
                                                                                                            
                                                            | 3952 | 3952 |  				} | 
                                                                                                            
                                                            | 3953 |  | -				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            |  | 3953 | +				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            | 3954 | 3954 |   | 
                                                                                                            
                                                            | 3955 | 3955 |  				$outvallabel = $objRef; | 
                                                                                                            
                                                            | 3956 | 3956 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                                                                            
                                                            | 3957 |  | -					$outvallabel .= ' (' . $objRefFourn . ')'; | 
                                                                                                            
                                                            |  | 3957 | +					$outvallabel .= ' ('.$objRefFourn.')'; | 
                                                                                                            
                                                            | 3958 | 3958 |  				} | 
                                                                                                            
                                                            | 3959 | 3959 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                                                                            
                                                            | 3960 |  | -					$outvallabel .= ' (' . $outbarcode . ')'; | 
                                                                                                            
                                                            |  | 3960 | +					$outvallabel .= ' ('.$outbarcode.')'; | 
                                                                                                            
                                                            | 3961 | 3961 |  				} | 
                                                                                                            
                                                            | 3962 |  | -				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            |  | 3962 | +				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); | 
                                                                                                            
                                                            | 3963 | 3963 |   | 
                                                                                                            
                                                            | 3964 | 3964 |  				// Units | 
                                                                                                            
                                                            | 3965 | 3965 |  				$optlabel .= $outvalUnits; | 
                                                                                                                                                        
                                                        |  | @@ -3976,7 +3976,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3976 | 3976 |  						$prod_supplier->fourn_tva_tx = $objp->tva_tx; | 
                                                                                                            
                                                            | 3977 | 3977 |  						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; | 
                                                                                                            
                                                            | 3978 | 3978 |   | 
                                                                                                            
                                                            | 3979 |  | -						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            |  | 3979 | +						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            | 3980 | 3980 |  						$priceparser = new PriceParser($this->db); | 
                                                                                                            
                                                            | 3981 | 3981 |  						$price_result = $priceparser->parseProductSupplier($prod_supplier); | 
                                                                                                            
                                                            | 3982 | 3982 |  						if ($price_result >= 0) { | 
                                                                                                                                                        
                                                        |  | @@ -3987,57 +3987,57 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 3987 | 3987 |  						} | 
                                                                                                            
                                                            | 3988 | 3988 |  					} | 
                                                                                                            
                                                            | 3989 | 3989 |  					if ($objp->quantity == 1) { | 
                                                                                                            
                                                            | 3990 |  | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                                                                            
                                                            | 3991 |  | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                                                                            
                                                            |  | 3990 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                                                                            
                                                            |  | 3991 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                                                                            
                                                            | 3992 | 3992 |  						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            | 3993 | 3993 |  						$outvallabel .= $langs->transnoentities("Unit"); | 
                                                                                                            
                                                            | 3994 | 3994 |  					} else { | 
                                                                                                            
                                                            | 3995 |  | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                                                                            
                                                            | 3996 |  | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                                                                            
                                                            | 3997 |  | -						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            | 3998 |  | -						$outvallabel .= ' ' . $langs->transnoentities("Units"); | 
                                                                                                            
                                                            |  | 3995 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                                                                            
                                                            |  | 3996 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                                                                            
                                                            |  | 3997 | +						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                                                                            
                                                            |  | 3998 | +						$outvallabel .= ' '.$langs->transnoentities("Units"); | 
                                                                                                            
                                                            | 3999 | 3999 |  					} | 
                                                                                                            
                                                            | 4000 | 4000 |   | 
                                                                                                            
                                                            | 4001 | 4001 |  					if ($objp->quantity > 1) { | 
                                                                                                            
                                                            | 4002 |  | -						$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 | 
                                                                                                            
                                                            | 4003 |  | -						$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 | 
                                                                                                            
                                                            |  | 4002 | +						$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 | 
                                                                                                            
                                                            |  | 4003 | +						$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 | 
                                                                                                            
                                                            | 4004 | 4004 |  					} | 
                                                                                                            
                                                            | 4005 | 4005 |  					if ($objp->remise_percent >= 1) { | 
                                                                                                            
                                                            | 4006 |  | -						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                                                                            
                                                            | 4007 |  | -						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                                                                            
                                                            |  | 4006 | +						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                                                                            
                                                            |  | 4007 | +						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                                                                            
                                                            | 4008 | 4008 |  					} | 
                                                                                                            
                                                            | 4009 | 4009 |  					if ($objp->duration) { | 
                                                                                                            
                                                            | 4010 |  | -						$optlabel .= " - " . $objp->duration; | 
                                                                                                            
                                                            | 4011 |  | -						$outvallabel .= " - " . $objp->duration; | 
                                                                                                            
                                                            |  | 4010 | +						$optlabel .= " - ".$objp->duration; | 
                                                                                                            
                                                            |  | 4011 | +						$outvallabel .= " - ".$objp->duration; | 
                                                                                                            
                                                            | 4012 | 4012 |  					} | 
                                                                                                            
                                                            | 4013 | 4013 |  					if (!$socid) { | 
                                                                                                            
                                                            | 4014 |  | -						$optlabel .= " - " . dol_trunc($objp->name, 8); | 
                                                                                                            
                                                            | 4015 |  | -						$outvallabel .= " - " . dol_trunc($objp->name, 8); | 
                                                                                                            
                                                            |  | 4014 | +						$optlabel .= " - ".dol_trunc($objp->name, 8); | 
                                                                                                            
                                                            |  | 4015 | +						$outvallabel .= " - ".dol_trunc($objp->name, 8); | 
                                                                                                            
                                                            | 4016 | 4016 |  					} | 
                                                                                                            
                                                            | 4017 | 4017 |  					if ($objp->supplier_reputation) { | 
                                                                                                            
                                                            | 4018 | 4018 |  						//TODO dictionary | 
                                                                                                            
                                                            | 4019 | 4019 |  						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); | 
                                                                                                            
                                                            | 4020 | 4020 |   | 
                                                                                                            
                                                            | 4021 |  | -						$optlabel .= " - " . $reputations[$objp->supplier_reputation]; | 
                                                                                                            
                                                            | 4022 |  | -						$outvallabel .= " - " . $reputations[$objp->supplier_reputation]; | 
                                                                                                            
                                                            |  | 4021 | +						$optlabel .= " - ".$reputations[$objp->supplier_reputation]; | 
                                                                                                            
                                                            |  | 4022 | +						$outvallabel .= " - ".$reputations[$objp->supplier_reputation]; | 
                                                                                                            
                                                            | 4023 | 4023 |  					} | 
                                                                                                            
                                                            | 4024 | 4024 |  				} else { | 
                                                                                                            
                                                            | 4025 |  | -					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                                                                            
                                                            | 4026 |  | -					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                                                                            
                                                            |  | 4025 | +					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                                                                            
                                                            |  | 4026 | +					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                                                                            
                                                            | 4027 | 4027 |  				} | 
                                                                                                            
                                                            | 4028 | 4028 |   | 
                                                                                                            
                                                            | 4029 | 4029 |  				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                                                                            
                                                            | 4030 | 4030 |  					$novirtualstock = ($showstockinlist == 2); | 
                                                                                                            
                                                            | 4031 | 4031 |   | 
                                                                                                            
                                                            | 4032 | 4032 |  					if ($user->hasRight('stock', 'lire')) { | 
                                                                                                            
                                                            | 4033 |  | -						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); | 
                                                                                                            
                                                            |  | 4033 | +						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); | 
                                                                                                            
                                                            | 4034 | 4034 |   | 
                                                                                                            
                                                            | 4035 | 4035 |  						if ($objp->stock > 0) { | 
                                                                                                            
                                                            | 4036 | 4036 |  							$optlabel .= ' - <span class="product_line_stock_ok">'; | 
                                                                                                            
                                                            | 4037 | 4037 |  						} elseif ($objp->stock <= 0) { | 
                                                                                                            
                                                            | 4038 | 4038 |  							$optlabel .= ' - <span class="product_line_stock_too_low">'; | 
                                                                                                            
                                                            | 4039 | 4039 |  						} | 
                                                                                                            
                                                            | 4040 |  | -						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); | 
                                                                                                            
                                                            |  | 4040 | +						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); | 
                                                                                                            
                                                            | 4041 | 4041 |  						$optlabel .= '</span>'; | 
                                                                                                            
                                                            | 4042 | 4042 |  						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                                                                            
                                                            | 4043 | 4043 |  							$langs->load("stocks"); | 
                                                                                                                                                        
                                                        |  | @@ -4047,9 +4047,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4047 | 4047 |  							$tmpproduct->load_virtual_stock(); | 
                                                                                                            
                                                            | 4048 | 4048 |  							$virtualstock = $tmpproduct->stock_theorique; | 
                                                                                                            
                                                            | 4049 | 4049 |   | 
                                                                                                            
                                                            | 4050 |  | -							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                                                                            
                                                            |  | 4050 | +							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                                                                            
                                                            | 4051 | 4051 |   | 
                                                                                                            
                                                            | 4052 |  | -							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                                                                            
                                                            |  | 4052 | +							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                                                                            
                                                            | 4053 | 4053 |  							if ($virtualstock > 0) { | 
                                                                                                            
                                                            | 4054 | 4054 |  								$optlabel .= '<span class="product_line_stock_ok">'; | 
                                                                                                            
                                                            | 4055 | 4055 |  							} elseif ($virtualstock <= 0) { | 
                                                                                                                                                        
                                                        |  | @@ -4063,7 +4063,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4063 | 4063 |  					} | 
                                                                                                            
                                                            | 4064 | 4064 |  				} | 
                                                                                                            
                                                            | 4065 | 4065 |   | 
                                                                                                            
                                                            | 4066 |  | -				$optstart = '<option value="' . $outkey . '"'; | 
                                                                                                            
                                                            |  | 4066 | +				$optstart = '<option value="'.$outkey.'"'; | 
                                                                                                            
                                                            | 4067 | 4067 |  				if ($selected && $selected == $objp->idprodfournprice) { | 
                                                                                                            
                                                            | 4068 | 4068 |  					$optstart .= ' selected'; | 
                                                                                                            
                                                            | 4069 | 4069 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -4072,22 +4072,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4072 | 4072 |  				} | 
                                                                                                            
                                                            | 4073 | 4073 |   | 
                                                                                                            
                                                            | 4074 | 4074 |  				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { | 
                                                                                                            
                                                            | 4075 |  | -					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; | 
                                                                                                            
                                                            | 4076 |  | -					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; | 
                                                                                                            
                                                            | 4077 |  | -					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; | 
                                                                                                            
                                                            | 4078 |  | -					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';		// the price with numeric international format | 
                                                                                                            
                                                            | 4079 |  | -					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';	// the price formatted in user language | 
                                                                                                            
                                                            | 4080 |  | -					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; | 
                                                                                                            
                                                            | 4081 |  | -					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';		// the rate with numeric international format | 
                                                                                                            
                                                            | 4082 |  | -					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';	// the rate formatted in user language | 
                                                                                                            
                                                            | 4083 |  | -					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; | 
                                                                                                            
                                                            | 4084 |  | -					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; | 
                                                                                                            
                                                            |  | 4075 | +					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; | 
                                                                                                            
                                                            |  | 4076 | +					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; | 
                                                                                                            
                                                            |  | 4077 | +					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; | 
                                                                                                            
                                                            |  | 4078 | +					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; // the price with numeric international format | 
                                                                                                            
                                                            |  | 4079 | +					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; // the price formatted in user language | 
                                                                                                            
                                                            |  | 4080 | +					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; | 
                                                                                                            
                                                            |  | 4081 | +					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; // the rate with numeric international format | 
                                                                                                            
                                                            |  | 4082 | +					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; // the rate formatted in user language | 
                                                                                                            
                                                            |  | 4083 | +					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; | 
                                                                                                            
                                                            |  | 4084 | +					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; | 
                                                                                                            
                                                            | 4085 | 4085 |  					if (isModEnabled('multicurrency')) { | 
                                                                                                            
                                                            | 4086 |  | -						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; | 
                                                                                                            
                                                            | 4087 |  | -						$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag(price2num($objp->multicurrency_unitprice)) . '"';	// the price with numeric international format | 
                                                                                                            
                                                            |  | 4086 | +						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; | 
                                                                                                            
                                                            |  | 4087 | +						$optstart .= ' data-multicurrency-unitprice="'.dol_escape_htmltag(price2num($objp->multicurrency_unitprice)).'"'; // the price with numeric international format | 
                                                                                                            
                                                            | 4088 | 4088 |  					} | 
                                                                                                            
                                                            | 4089 | 4089 |  				} | 
                                                                                                            
                                                            | 4090 |  | -				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; | 
                                                                                                            
                                                            |  | 4090 | +				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; | 
                                                                                                            
                                                            | 4091 | 4091 |   | 
                                                                                                            
                                                            | 4092 | 4092 |  				// set $parameters to call hook | 
                                                                                                            
                                                            | 4093 | 4093 |  				$outarrayentry = array( | 
                                                                                                                                                        
                                                        |  | @@ -4096,9 +4096,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4096 | 4096 |  					'label' => $outvallabel, | 
                                                                                                            
                                                            | 4097 | 4097 |  					'labelhtml' => $optlabel, | 
                                                                                                            
                                                            | 4098 | 4098 |  					'qty' => $outqty, | 
                                                                                                            
                                                            | 4099 |  | -					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty | 
                                                                                                            
                                                            | 4100 |  | -					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price | 
                                                                                                            
                                                            | 4101 |  | -					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility) | 
                                                                                                            
                                                            |  | 4099 | +					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty | 
                                                                                                            
                                                            |  | 4100 | +					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price | 
                                                                                                            
                                                            |  | 4101 | +					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) | 
                                                                                                            
                                                            | 4102 | 4102 |  					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), | 
                                                                                                            
                                                            | 4103 | 4103 |  					'tva_tx' => price2num($objp->tva_tx), | 
                                                                                                            
                                                            | 4104 | 4104 |  					'default_vat_code' => $objp->default_vat_code, | 
                                                                                                                                                        
                                                        |  | @@ -4128,18 +4128,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4128 | 4128 |  				// Add new entry | 
                                                                                                            
                                                            | 4129 | 4129 |  				// "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 | 
                                                                                                            
                                                            | 4130 | 4130 |  				// "label" value of json key array is used by jQuery automatically as text for combo box | 
                                                                                                            
                                                            | 4131 |  | -				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; | 
                                                                                                            
                                                            |  | 4131 | +				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; | 
                                                                                                            
                                                            | 4132 | 4132 |  				$outarraypush = array( | 
                                                                                                            
                                                            | 4133 | 4133 |  					'key' => $outkey, | 
                                                                                                            
                                                            | 4134 | 4134 |  					'value' => $outref, | 
                                                                                                            
                                                            | 4135 | 4135 |  					'label' => $outvallabel, | 
                                                                                                            
                                                            | 4136 | 4136 |  					'labelhtml' => $optlabel, | 
                                                                                                            
                                                            | 4137 | 4137 |  					'qty' => $outqty, | 
                                                                                                            
                                                            | 4138 |  | -					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty | 
                                                                                                            
                                                            |  | 4138 | +					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty | 
                                                                                                            
                                                            | 4139 | 4139 |  					'price_qty_ht_locale' => price($objp->fprice), | 
                                                                                                            
                                                            | 4140 |  | -					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price | 
                                                                                                            
                                                            |  | 4140 | +					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price | 
                                                                                                            
                                                            | 4141 | 4141 |  					'price_unit_ht_locale' => price($objp->unitprice), | 
                                                                                                            
                                                            | 4142 |  | -					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility) | 
                                                                                                            
                                                            |  | 4142 | +					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) | 
                                                                                                            
                                                            | 4143 | 4143 |  					'tva_tx_formated' => price($objp->tva_tx), | 
                                                                                                            
                                                            | 4144 | 4144 |  					'tva_tx' => price2num($objp->tva_tx), | 
                                                                                                            
                                                            | 4145 | 4145 |  					'default_vat_code' => $objp->default_vat_code, | 
                                                                                                                                                        
                                                        |  | @@ -4172,7 +4172,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4172 | 4172 |   | 
                                                                                                            
                                                            | 4173 | 4173 |  			$this->db->free($result); | 
                                                                                                            
                                                            | 4174 | 4174 |   | 
                                                                                                            
                                                            | 4175 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 4175 | +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 4176 | 4176 |  			$out .= ajax_combobox($htmlname); | 
                                                                                                            
                                                            | 4177 | 4177 |  		} else { | 
                                                                                                            
                                                            | 4178 | 4178 |  			dol_print_error($this->db); | 
                                                                                                                                                        
                                                        |  | @@ -4204,43 +4204,43 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4204 | 4204 |  		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; | 
                                                                                                            
                                                            | 4205 | 4205 |  		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; | 
                                                                                                            
                                                            | 4206 | 4206 |  		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; | 
                                                                                                            
                                                            | 4207 |  | -		$sql .= " FROM " . $this->db->prefix() . "product as p"; | 
                                                                                                            
                                                            | 4208 |  | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; | 
                                                                                                            
                                                            | 4209 |  | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; | 
                                                                                                            
                                                            | 4210 |  | -		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; | 
                                                                                                            
                                                            |  | 4207 | +		$sql .= " FROM ".$this->db->prefix()."product as p"; | 
                                                                                                            
                                                            |  | 4208 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; | 
                                                                                                            
                                                            |  | 4209 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; | 
                                                                                                            
                                                            |  | 4210 | +		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; | 
                                                                                                            
                                                            | 4211 | 4211 |  		$sql .= " AND p.tobuy = 1"; | 
                                                                                                            
                                                            | 4212 | 4212 |  		$sql .= " AND s.fournisseur = 1"; | 
                                                                                                            
                                                            | 4213 |  | -		$sql .= " AND p.rowid = " . ((int) $productid); | 
                                                                                                            
                                                            |  | 4213 | +		$sql .= " AND p.rowid = ".((int) $productid); | 
                                                                                                            
                                                            | 4214 | 4214 |  		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { | 
                                                                                                            
                                                            | 4215 | 4215 |  			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; | 
                                                                                                            
                                                            | 4216 | 4216 |  		} else { | 
                                                                                                            
                                                            | 4217 | 4217 |  			$sql .= " ORDER BY pfp.unitprice ASC"; | 
                                                                                                            
                                                            | 4218 | 4218 |  		} | 
                                                                                                            
                                                            | 4219 | 4219 |   | 
                                                                                                            
                                                            | 4220 |  | -		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 4220 | +		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); | 
                                                                                                            
                                                            | 4221 | 4221 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 4222 | 4222 |   | 
                                                                                                            
                                                            | 4223 | 4223 |  		if ($result) { | 
                                                                                                            
                                                            | 4224 | 4224 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 4225 | 4225 |   | 
                                                                                                            
                                                            | 4226 |  | -			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4226 | +			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4227 | 4227 |   | 
                                                                                                            
                                                            | 4228 | 4228 |  			if (!$num) { | 
                                                                                                            
                                                            | 4229 |  | -				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; | 
                                                                                                            
                                                            |  | 4229 | +				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; | 
                                                                                                            
                                                            | 4230 | 4230 |  			} else { | 
                                                                                                            
                                                            | 4231 |  | -				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            |  | 4231 | +				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            | 4232 | 4232 |  				$form .= '<option value="0"> </option>'; | 
                                                                                                            
                                                            | 4233 | 4233 |   | 
                                                                                                            
                                                            | 4234 | 4234 |  				$i = 0; | 
                                                                                                            
                                                            | 4235 | 4235 |  				while ($i < $num) { | 
                                                                                                            
                                                            | 4236 | 4236 |  					$objp = $this->db->fetch_object($result); | 
                                                                                                            
                                                            | 4237 | 4237 |   | 
                                                                                                            
                                                            | 4238 |  | -					$opt = '<option value="' . $objp->idprodfournprice . '"'; | 
                                                                                                            
                                                            |  | 4238 | +					$opt = '<option value="'.$objp->idprodfournprice.'"'; | 
                                                                                                            
                                                            | 4239 | 4239 |  					//if there is only one supplier, preselect it | 
                                                                                                            
                                                            | 4240 | 4240 |  					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { | 
                                                                                                            
                                                            | 4241 | 4241 |  						$opt .= ' selected'; | 
                                                                                                            
                                                            | 4242 | 4242 |  					} | 
                                                                                                            
                                                            | 4243 |  | -					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; | 
                                                                                                            
                                                            |  | 4243 | +					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; | 
                                                                                                            
                                                            | 4244 | 4244 |   | 
                                                                                                            
                                                            | 4245 | 4245 |  					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { | 
                                                                                                            
                                                            | 4246 | 4246 |  						$prod_supplier = new ProductFournisseur($this->db); | 
                                                                                                                                                        
                                                        |  | @@ -4250,7 +4250,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4250 | 4250 |  						$prod_supplier->fourn_tva_tx = $objp->tva_tx; | 
                                                                                                            
                                                            | 4251 | 4251 |  						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; | 
                                                                                                            
                                                            | 4252 | 4252 |   | 
                                                                                                            
                                                            | 4253 |  | -						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            |  | 4253 | +						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; | 
                                                                                                            
                                                            | 4254 | 4254 |  						$priceparser = new PriceParser($this->db); | 
                                                                                                            
                                                            | 4255 | 4255 |  						$price_result = $priceparser->parseProductSupplier($prod_supplier); | 
                                                                                                            
                                                            | 4256 | 4256 |  						if ($price_result >= 0) { | 
                                                                                                                                                        
                                                        |  | @@ -4261,10 +4261,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4261 | 4261 |  						} | 
                                                                                                            
                                                            | 4262 | 4262 |  					} | 
                                                                                                            
                                                            | 4263 | 4263 |  					if ($objp->quantity == 1) { | 
                                                                                                            
                                                            | 4264 |  | -						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                                                                            
                                                            |  | 4264 | +						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                                                                            
                                                            | 4265 | 4265 |  					} | 
                                                                                                            
                                                            | 4266 | 4266 |   | 
                                                                                                            
                                                            | 4267 |  | -					$opt .= $objp->quantity . ' '; | 
                                                                                                            
                                                            |  | 4267 | +					$opt .= $objp->quantity.' '; | 
                                                                                                            
                                                            | 4268 | 4268 |   | 
                                                                                                            
                                                            | 4269 | 4269 |  					if ($objp->quantity == 1) { | 
                                                                                                            
                                                            | 4270 | 4270 |  						$opt .= $langs->trans("Unit"); | 
                                                                                                                                                        
                                                        |  | @@ -4273,10 +4273,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4273 | 4273 |  					} | 
                                                                                                            
                                                            | 4274 | 4274 |  					if ($objp->quantity > 1) { | 
                                                                                                            
                                                            | 4275 | 4275 |  						$opt .= " - "; | 
                                                                                                            
                                                            | 4276 |  | -						$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"); | 
                                                                                                            
                                                            |  | 4276 | +						$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"); | 
                                                                                                            
                                                            | 4277 | 4277 |  					} | 
                                                                                                            
                                                            | 4278 | 4278 |  					if ($objp->duration) { | 
                                                                                                            
                                                            | 4279 |  | -						$opt .= " - " . $objp->duration; | 
                                                                                                            
                                                            |  | 4279 | +						$opt .= " - ".$objp->duration; | 
                                                                                                            
                                                            | 4280 | 4280 |  					} | 
                                                                                                            
                                                            | 4281 | 4281 |  					$opt .= "</option>\n"; | 
                                                                                                            
                                                            | 4282 | 4282 |   | 
                                                                                                                                                        
                                                        |  | @@ -4314,8 +4314,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4314 | 4314 |  		dol_syslog(__METHOD__, LOG_DEBUG); | 
                                                                                                            
                                                            | 4315 | 4315 |   | 
                                                                                                            
                                                            | 4316 | 4316 |  		$sql = "SELECT rowid, code, libelle as label, deposit_percent"; | 
                                                                                                            
                                                            | 4317 |  | -		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; | 
                                                                                                            
                                                            | 4318 |  | -		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; | 
                                                                                                            
                                                            |  | 4317 | +		$sql .= " FROM ".$this->db->prefix().'c_payment_term'; | 
                                                                                                            
                                                            |  | 4318 | +		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; | 
                                                                                                            
                                                            | 4319 | 4319 |  		$sql .= " AND active > 0"; | 
                                                                                                            
                                                            | 4320 | 4320 |  		$sql .= " ORDER BY sortorder"; | 
                                                                                                            
                                                            | 4321 | 4321 |   | 
                                                                                                                                                        
                                                        |  | @@ -4327,7 +4327,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4327 | 4327 |  				$obj = $this->db->fetch_object($resql); | 
                                                                                                            
                                                            | 4328 | 4328 |   | 
                                                                                                            
                                                            | 4329 | 4329 |  				// Si traduction existe, on l'utilise, sinon on prend le libelle par default | 
                                                                                                            
                                                            | 4330 |  | -				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            |  | 4330 | +				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            | 4331 | 4331 |  				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; | 
                                                                                                            
                                                            | 4332 | 4332 |  				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; | 
                                                                                                            
                                                            | 4333 | 4333 |  				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; | 
                                                                                                                                                        
                                                        |  | @@ -4355,7 +4355,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4355 | 4355 |  		// phpcs:enable | 
                                                                                                            
                                                            | 4356 | 4356 |  		global $langs; | 
                                                                                                            
                                                            | 4357 | 4357 |   | 
                                                                                                            
                                                            | 4358 |  | -		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability | 
                                                                                                            
                                                            |  | 4358 | +		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability | 
                                                                                                            
                                                            | 4359 | 4359 |  		if ($num > 0) { | 
                                                                                                            
                                                            | 4360 | 4360 |  			return 0; // Cache already loaded | 
                                                                                                            
                                                            | 4361 | 4361 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -4365,7 +4365,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4365 | 4365 |  		$langs->load('propal'); | 
                                                                                                            
                                                            | 4366 | 4366 |   | 
                                                                                                            
                                                            | 4367 | 4367 |  		$sql = "SELECT rowid, code, label, position"; | 
                                                                                                            
                                                            | 4368 |  | -		$sql .= " FROM " . $this->db->prefix() . 'c_availability'; | 
                                                                                                            
                                                            |  | 4368 | +		$sql .= " FROM ".$this->db->prefix().'c_availability'; | 
                                                                                                            
                                                            | 4369 | 4369 |  		$sql .= " WHERE active > 0"; | 
                                                                                                            
                                                            | 4370 | 4370 |   | 
                                                                                                            
                                                            | 4371 | 4371 |  		$resql = $this->db->query($sql); | 
                                                                                                                                                        
                                                        |  | @@ -4376,7 +4376,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4376 | 4376 |  				$obj = $this->db->fetch_object($resql); | 
                                                                                                            
                                                            | 4377 | 4377 |   | 
                                                                                                            
                                                            | 4378 | 4378 |  				// Si traduction existe, on l'utilise, sinon on prend le libelle par default | 
                                                                                                            
                                                            | 4379 |  | -				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            |  | 4379 | +				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            | 4380 | 4380 |  				$this->cache_availability[$obj->rowid]['code'] = $obj->code; | 
                                                                                                            
                                                            | 4381 | 4381 |  				$this->cache_availability[$obj->rowid]['label'] = $label; | 
                                                                                                            
                                                            | 4382 | 4382 |  				$this->cache_availability[$obj->rowid]['position'] = $obj->position; | 
                                                                                                                                                        
                                                        |  | @@ -4408,17 +4408,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4408 | 4408 |   | 
                                                                                                            
                                                            | 4409 | 4409 |  		$this->load_cache_availability(); | 
                                                                                                            
                                                            | 4410 | 4410 |   | 
                                                                                                            
                                                            | 4411 |  | -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 4411 | +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            | 4412 | 4412 |   | 
                                                                                                            
                                                            | 4413 |  | -		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4413 | +		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4414 | 4414 |  		if ($addempty) { | 
                                                                                                            
                                                            | 4415 | 4415 |  			print '<option value="0"> </option>'; | 
                                                                                                            
                                                            | 4416 | 4416 |  		} | 
                                                                                                            
                                                            | 4417 | 4417 |  		foreach ($this->cache_availability as $id => $arrayavailability) { | 
                                                                                                            
                                                            | 4418 | 4418 |  			if ($selected == $id) { | 
                                                                                                            
                                                            | 4419 |  | -				print '<option value="' . $id . '" selected>'; | 
                                                                                                            
                                                            |  | 4419 | +				print '<option value="'.$id.'" selected>'; | 
                                                                                                            
                                                            | 4420 | 4420 |  			} else { | 
                                                                                                            
                                                            | 4421 |  | -				print '<option value="' . $id . '">'; | 
                                                                                                            
                                                            |  | 4421 | +				print '<option value="'.$id.'">'; | 
                                                                                                            
                                                            | 4422 | 4422 |  			} | 
                                                                                                            
                                                            | 4423 | 4423 |  			print dol_escape_htmltag($arrayavailability['label']); | 
                                                                                                            
                                                            | 4424 | 4424 |  			print '</option>'; | 
                                                                                                                                                        
                                                        |  | @@ -4439,13 +4439,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4439 | 4439 |  	{ | 
                                                                                                            
                                                            | 4440 | 4440 |  		global $langs; | 
                                                                                                            
                                                            | 4441 | 4441 |   | 
                                                                                                            
                                                            | 4442 |  | -		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason | 
                                                                                                            
                                                            |  | 4442 | +		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason | 
                                                                                                            
                                                            | 4443 | 4443 |  		if ($num > 0) { | 
                                                                                                            
                                                            | 4444 | 4444 |  			return 0; // Cache already loaded | 
                                                                                                            
                                                            | 4445 | 4445 |  		} | 
                                                                                                            
                                                            | 4446 | 4446 |   | 
                                                                                                            
                                                            | 4447 | 4447 |  		$sql = "SELECT rowid, code, label"; | 
                                                                                                            
                                                            | 4448 |  | -		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; | 
                                                                                                            
                                                            |  | 4448 | +		$sql .= " FROM ".$this->db->prefix().'c_input_reason'; | 
                                                                                                            
                                                            | 4449 | 4449 |  		$sql .= " WHERE active > 0"; | 
                                                                                                            
                                                            | 4450 | 4450 |   | 
                                                                                                            
                                                            | 4451 | 4451 |  		$resql = $this->db->query($sql); | 
                                                                                                                                                        
                                                        |  | @@ -4458,8 +4458,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4458 | 4458 |   | 
                                                                                                            
                                                            | 4459 | 4459 |  				// Si traduction existe, on l'utilise, sinon on prend le libelle par default | 
                                                                                                            
                                                            | 4460 | 4460 |  				$label = ($obj->label != '-' ? $obj->label : ''); | 
                                                                                                            
                                                            | 4461 |  | -				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { | 
                                                                                                            
                                                            | 4462 |  | -					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                                                                            
                                                            |  | 4461 | +				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { | 
                                                                                                            
                                                            |  | 4462 | +					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                                                                            
                                                            | 4463 | 4463 |  				} | 
                                                                                                            
                                                            | 4464 | 4464 |  				if ($langs->trans($obj->code) != $obj->code) { | 
                                                                                                            
                                                            | 4465 | 4465 |  					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work | 
                                                                                                                                                        
                                                        |  | @@ -4499,9 +4499,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4499 | 4499 |   | 
                                                                                                            
                                                            | 4500 | 4500 |  		$this->loadCacheInputReason(); | 
                                                                                                            
                                                            | 4501 | 4501 |   | 
                                                                                                            
                                                            | 4502 |  | -		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4502 | +		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4503 | 4503 |  		if ($addempty) { | 
                                                                                                            
                                                            | 4504 |  | -			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; | 
                                                                                                            
                                                            |  | 4504 | +			print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; | 
                                                                                                            
                                                            | 4505 | 4505 |  		} | 
                                                                                                            
                                                            | 4506 | 4506 |  		foreach ($this->cache_demand_reason as $id => $arraydemandreason) { | 
                                                                                                            
                                                            | 4507 | 4507 |  			if ($arraydemandreason['code'] == $exclude) { | 
                                                                                                                                                        
                                                        |  | @@ -4509,9 +4509,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4509 | 4509 |  			} | 
                                                                                                            
                                                            | 4510 | 4510 |   | 
                                                                                                            
                                                            | 4511 | 4511 |  			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { | 
                                                                                                            
                                                            | 4512 |  | -				print '<option value="' . $arraydemandreason['id'] . '" selected>'; | 
                                                                                                            
                                                            |  | 4512 | +				print '<option value="'.$arraydemandreason['id'].'" selected>'; | 
                                                                                                            
                                                            | 4513 | 4513 |  			} else { | 
                                                                                                            
                                                            | 4514 |  | -				print '<option value="' . $arraydemandreason['id'] . '">'; | 
                                                                                                            
                                                            |  | 4514 | +				print '<option value="'.$arraydemandreason['id'].'">'; | 
                                                                                                            
                                                            | 4515 | 4515 |  			} | 
                                                                                                            
                                                            | 4516 | 4516 |  			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason | 
                                                                                                            
                                                            | 4517 | 4517 |  			print $langs->trans($label); | 
                                                                                                                                                        
                                                        |  | @@ -4521,7 +4521,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4521 | 4521 |  		if ($user->admin && empty($notooltip)) { | 
                                                                                                            
                                                            | 4522 | 4522 |  			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                                                                            
                                                            | 4523 | 4523 |  		} | 
                                                                                                            
                                                            | 4524 |  | -		print ajax_combobox('select_' . $htmlname); | 
                                                                                                            
                                                            |  | 4524 | +		print ajax_combobox('select_'.$htmlname); | 
                                                                                                            
                                                            | 4525 | 4525 |  	} | 
                                                                                                            
                                                            | 4526 | 4526 |   | 
                                                                                                            
                                                            | 4527 | 4527 |  	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps | 
                                                                                                                                                        
                                                        |  | @@ -4536,7 +4536,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4536 | 4536 |  		// phpcs:enable | 
                                                                                                            
                                                            | 4537 | 4537 |  		global $langs; | 
                                                                                                            
                                                            | 4538 | 4538 |   | 
                                                                                                            
                                                            | 4539 |  | -		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements | 
                                                                                                            
                                                            |  | 4539 | +		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements | 
                                                                                                            
                                                            | 4540 | 4540 |  		if ($num > 0) { | 
                                                                                                            
                                                            | 4541 | 4541 |  			return $num; // Cache already loaded | 
                                                                                                            
                                                            | 4542 | 4542 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -4546,8 +4546,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4546 | 4546 |  		$this->cache_types_paiements = array(); | 
                                                                                                            
                                                            | 4547 | 4547 |   | 
                                                                                                            
                                                            | 4548 | 4548 |  		$sql = "SELECT id, code, libelle as label, type, active"; | 
                                                                                                            
                                                            | 4549 |  | -		$sql .= " FROM " . $this->db->prefix() . "c_paiement"; | 
                                                                                                            
                                                            | 4550 |  | -		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; | 
                                                                                                            
                                                            |  | 4549 | +		$sql .= " FROM ".$this->db->prefix()."c_paiement"; | 
                                                                                                            
                                                            |  | 4550 | +		$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; | 
                                                                                                            
                                                            | 4551 | 4551 |   | 
                                                                                                            
                                                            | 4552 | 4552 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 4553 | 4553 |  		if ($resql) { | 
                                                                                                                                                        
                                                        |  | @@ -4557,7 +4557,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4557 | 4557 |  				$obj = $this->db->fetch_object($resql); | 
                                                                                                            
                                                            | 4558 | 4558 |   | 
                                                                                                            
                                                            | 4559 | 4559 |  				// Si traduction existe, on l'utilise, sinon on prend le libelle par default | 
                                                                                                            
                                                            | 4560 |  | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            |  | 4560 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            | 4561 | 4561 |  				$this->cache_types_paiements[$obj->id]['id'] = $obj->id; | 
                                                                                                            
                                                            | 4562 | 4562 |  				$this->cache_types_paiements[$obj->id]['code'] = $obj->code; | 
                                                                                                            
                                                            | 4563 | 4563 |  				$this->cache_types_paiements[$obj->id]['label'] = $label; | 
                                                                                                                                                        
                                                        |  | @@ -4629,17 +4629,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4629 | 4629 |  		global $langs, $user, $conf; | 
                                                                                                            
                                                            | 4630 | 4630 |   | 
                                                                                                            
                                                            | 4631 | 4631 |  		$out = ''; | 
                                                                                                            
                                                            | 4632 |  | -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 4632 | +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            | 4633 | 4633 |   | 
                                                                                                            
                                                            | 4634 | 4634 |  		$this->load_cache_conditions_paiements(); | 
                                                                                                            
                                                            | 4635 | 4635 |   | 
                                                                                                            
                                                            | 4636 | 4636 |  		// Set default value if not already set by caller | 
                                                                                                            
                                                            | 4637 | 4637 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { | 
                                                                                                            
                                                            | 4638 |  | -			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); | 
                                                                                                            
                                                            |  | 4638 | +			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); | 
                                                                                                            
                                                            | 4639 | 4639 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); | 
                                                                                                            
                                                            | 4640 | 4640 |  		} | 
                                                                                                            
                                                            | 4641 | 4641 |   | 
                                                                                                            
                                                            | 4642 |  | -		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4642 | +		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4643 | 4643 |  		if ($addempty) { | 
                                                                                                            
                                                            | 4644 | 4644 |  			$out .= '<option value="0"> </option>'; | 
                                                                                                            
                                                            | 4645 | 4645 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -4653,9 +4653,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4653 | 4653 |   | 
                                                                                                            
                                                            | 4654 | 4654 |  			if ($selected == $id) { | 
                                                                                                            
                                                            | 4655 | 4655 |  				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; | 
                                                                                                            
                                                            | 4656 |  | -				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; | 
                                                                                                            
                                                            |  | 4656 | +				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; | 
                                                                                                            
                                                            | 4657 | 4657 |  			} else { | 
                                                                                                            
                                                            | 4658 |  | -				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; | 
                                                                                                            
                                                            |  | 4658 | +				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; | 
                                                                                                            
                                                            | 4659 | 4659 |  			} | 
                                                                                                            
                                                            | 4660 | 4660 |  			$label = $arrayconditions['label']; | 
                                                                                                            
                                                            | 4661 | 4661 |   | 
                                                                                                                                                        
                                                        |  | @@ -4673,21 +4673,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4673 | 4673 |  		$out .= ajax_combobox($htmlname); | 
                                                                                                            
                                                            | 4674 | 4674 |   | 
                                                                                                            
                                                            | 4675 | 4675 |  		if ($deposit_percent >= 0) { | 
                                                                                                            
                                                            | 4676 |  | -			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; | 
                                                                                                            
                                                            | 4677 |  | -			$out .= $langs->trans('DepositPercent') . ' : '; | 
                                                                                                            
                                                            | 4678 |  | -			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; | 
                                                                                                            
                                                            |  | 4676 | +			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; | 
                                                                                                            
                                                            |  | 4677 | +			$out .= $langs->trans('DepositPercent').' : '; | 
                                                                                                            
                                                            |  | 4678 | +			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; | 
                                                                                                            
                                                            | 4679 | 4679 |  			$out .= '</span>'; | 
                                                                                                            
                                                            | 4680 | 4680 |  			$out .= ' | 
                                                                                                            
                                                            | 4681 |  | -				<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 4681 | +				<script nonce="' . getNonce().'"> | 
                                                                                                            
                                                            | 4682 | 4682 |  					$(document).ready(function () { | 
                                                                                                            
                                                            | 4683 |  | -						$("#' . $htmlname . '").change(function () { | 
                                                                                                            
                                                            |  | 4683 | +						$("#' . $htmlname.'").change(function () { | 
                                                                                                            
                                                            | 4684 | 4684 |  							let $selected = $(this).find("option:selected"); | 
                                                                                                            
                                                            | 4685 | 4685 |  							let depositPercent = $selected.attr("data-deposit_percent"); | 
                                                                                                            
                                                            | 4686 | 4686 |   | 
                                                                                                            
                                                            | 4687 | 4687 |  							if (depositPercent.length > 0) { | 
                                                                                                            
                                                            | 4688 |  | -								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); | 
                                                                                                            
                                                            |  | 4688 | +								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); | 
                                                                                                            
                                                            | 4689 | 4689 |  							} else { | 
                                                                                                            
                                                            | 4690 |  | -								$("#' . $htmlname . '_deposit_percent_container").hide(); | 
                                                                                                            
                                                            |  | 4690 | +								$("#' . $htmlname.'_deposit_percent_container").hide(); | 
                                                                                                            
                                                            | 4691 | 4691 |  							} | 
                                                                                                            
                                                            | 4692 | 4692 |   | 
                                                                                                            
                                                            | 4693 | 4693 |  							return true; | 
                                                                                                                                                        
                                                        |  | @@ -4725,7 +4725,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4725 | 4725 |   | 
                                                                                                            
                                                            | 4726 | 4726 |  		$out = ''; | 
                                                                                                            
                                                            | 4727 | 4727 |   | 
                                                                                                            
                                                            | 4728 |  | -		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 4728 | +		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); | 
                                                                                                            
                                                            | 4729 | 4729 |   | 
                                                                                                            
                                                            | 4730 | 4730 |  		$filterarray = array(); | 
                                                                                                            
                                                            | 4731 | 4731 |  		if ($filtertype == 'CRDT') { | 
                                                                                                                                                        
                                                        |  | @@ -4740,11 +4740,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4740 | 4740 |   | 
                                                                                                            
                                                            | 4741 | 4741 |  		// Set default value if not already set by caller | 
                                                                                                            
                                                            | 4742 | 4742 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { | 
                                                                                                            
                                                            | 4743 |  | -			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); | 
                                                                                                            
                                                            |  | 4743 | +			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); | 
                                                                                                            
                                                            | 4744 | 4744 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); | 
                                                                                                            
                                                            | 4745 | 4745 |  		} | 
                                                                                                            
                                                            | 4746 | 4746 |   | 
                                                                                                            
                                                            | 4747 |  | -		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4747 | +		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4748 | 4748 |  		if ($empty) { | 
                                                                                                            
                                                            | 4749 | 4749 |  			$out .= '<option value=""> </option>'; | 
                                                                                                            
                                                            | 4750 | 4750 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -4765,13 +4765,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4765 | 4765 |  			} | 
                                                                                                            
                                                            | 4766 | 4766 |   | 
                                                                                                            
                                                            | 4767 | 4767 |  			if ($format == 0) { | 
                                                                                                            
                                                            | 4768 |  | -				$out .= '<option value="' . $id . '" data-code="'.$arraytypes['code'].'"'; | 
                                                                                                            
                                                            |  | 4768 | +				$out .= '<option value="'.$id.'" data-code="'.$arraytypes['code'].'"'; | 
                                                                                                            
                                                            | 4769 | 4769 |  			} elseif ($format == 1) { | 
                                                                                                            
                                                            | 4770 |  | -				$out .= '<option value="' . $arraytypes['code'] . '"'; | 
                                                                                                            
                                                            |  | 4770 | +				$out .= '<option value="'.$arraytypes['code'].'"'; | 
                                                                                                            
                                                            | 4771 | 4771 |  			} elseif ($format == 2) { | 
                                                                                                            
                                                            | 4772 |  | -				$out .= '<option value="' . $arraytypes['code'] . '"'; | 
                                                                                                            
                                                            |  | 4772 | +				$out .= '<option value="'.$arraytypes['code'].'"'; | 
                                                                                                            
                                                            | 4773 | 4773 |  			} elseif ($format == 3) { | 
                                                                                                            
                                                            | 4774 |  | -				$out .= '<option value="' . $id . '"'; | 
                                                                                                            
                                                            |  | 4774 | +				$out .= '<option value="'.$id.'"'; | 
                                                                                                            
                                                            | 4775 | 4775 |  			} | 
                                                                                                            
                                                            | 4776 | 4776 |  			// Print attribute selected or not | 
                                                                                                            
                                                            | 4777 | 4777 |  			if ($format == 1 || $format == 2) { | 
                                                                                                                                                        
                                                        |  | @@ -4801,7 +4801,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4801 | 4801 |  		if ($user->admin && !$noadmininfo) { | 
                                                                                                            
                                                            | 4802 | 4802 |  			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                                                                            
                                                            | 4803 | 4803 |  		} | 
                                                                                                            
                                                            | 4804 |  | -		$out .= ajax_combobox('select' . $htmlname); | 
                                                                                                            
                                                            |  | 4804 | +		$out .= ajax_combobox('select'.$htmlname); | 
                                                                                                            
                                                            | 4805 | 4805 |   | 
                                                                                                            
                                                            | 4806 | 4806 |  		if (empty($nooutput)) { | 
                                                                                                            
                                                            | 4807 | 4807 |  			print $out; | 
                                                                                                                                                        
                                                        |  | @@ -4823,22 +4823,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4823 | 4823 |  	{ | 
                                                                                                            
                                                            | 4824 | 4824 |  		global $langs; | 
                                                                                                            
                                                            | 4825 | 4825 |   | 
                                                                                                            
                                                            | 4826 |  | -		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4826 | +		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4827 | 4827 |  		$options = array( | 
                                                                                                            
                                                            | 4828 | 4828 |  			'HT' => $langs->trans("HT"), | 
                                                                                                            
                                                            | 4829 | 4829 |  			'TTC' => $langs->trans("TTC") | 
                                                                                                            
                                                            | 4830 | 4830 |  		); | 
                                                                                                            
                                                            | 4831 | 4831 |  		foreach ($options as $id => $value) { | 
                                                                                                            
                                                            | 4832 | 4832 |  			if ($selected == $id) { | 
                                                                                                            
                                                            | 4833 |  | -				$return .= '<option value="' . $id . '" selected>' . $value; | 
                                                                                                            
                                                            |  | 4833 | +				$return .= '<option value="'.$id.'" selected>'.$value; | 
                                                                                                            
                                                            | 4834 | 4834 |  			} else { | 
                                                                                                            
                                                            | 4835 |  | -				$return .= '<option value="' . $id . '">' . $value; | 
                                                                                                            
                                                            |  | 4835 | +				$return .= '<option value="'.$id.'">'.$value; | 
                                                                                                            
                                                            | 4836 | 4836 |  			} | 
                                                                                                            
                                                            | 4837 | 4837 |  			$return .= '</option>'; | 
                                                                                                            
                                                            | 4838 | 4838 |  		} | 
                                                                                                            
                                                            | 4839 | 4839 |  		$return .= '</select>'; | 
                                                                                                            
                                                            | 4840 | 4840 |  		if ($addjscombo) { | 
                                                                                                            
                                                            | 4841 |  | -			$return .= ajax_combobox('select_' . $htmlname); | 
                                                                                                            
                                                            |  | 4841 | +			$return .= ajax_combobox('select_'.$htmlname); | 
                                                                                                            
                                                            | 4842 | 4842 |  		} | 
                                                                                                            
                                                            | 4843 | 4843 |   | 
                                                                                                            
                                                            | 4844 | 4844 |  		return $return; | 
                                                                                                                                                        
                                                        |  | @@ -4856,7 +4856,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4856 | 4856 |  		// phpcs:enable | 
                                                                                                            
                                                            | 4857 | 4857 |  		global $langs; | 
                                                                                                            
                                                            | 4858 | 4858 |   | 
                                                                                                            
                                                            | 4859 |  | -		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode | 
                                                                                                            
                                                            |  | 4859 | +		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode | 
                                                                                                            
                                                            | 4860 | 4860 |  		if ($num > 0) { | 
                                                                                                            
                                                            | 4861 | 4861 |  			return $num; // Cache already loaded | 
                                                                                                            
                                                            | 4862 | 4862 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -4866,8 +4866,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4866 | 4866 |  		$this->cache_transport_mode = array(); | 
                                                                                                            
                                                            | 4867 | 4867 |   | 
                                                                                                            
                                                            | 4868 | 4868 |  		$sql = "SELECT rowid, code, label, active"; | 
                                                                                                            
                                                            | 4869 |  | -		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; | 
                                                                                                            
                                                            | 4870 |  | -		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; | 
                                                                                                            
                                                            |  | 4869 | +		$sql .= " FROM ".$this->db->prefix()."c_transport_mode"; | 
                                                                                                            
                                                            |  | 4870 | +		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; | 
                                                                                                            
                                                            | 4871 | 4871 |   | 
                                                                                                            
                                                            | 4872 | 4872 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 4873 | 4873 |  		if ($resql) { | 
                                                                                                                                                        
                                                        |  | @@ -4877,7 +4877,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4877 | 4877 |  				$obj = $this->db->fetch_object($resql); | 
                                                                                                            
                                                            | 4878 | 4878 |   | 
                                                                                                            
                                                            | 4879 | 4879 |  				// If traduction exist, we use it else we take the default label | 
                                                                                                            
                                                            | 4880 |  | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            |  | 4880 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                                                                            
                                                            | 4881 | 4881 |  				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; | 
                                                                                                            
                                                            | 4882 | 4882 |  				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; | 
                                                                                                            
                                                            | 4883 | 4883 |  				$this->cache_transport_mode[$obj->rowid]['label'] = $label; | 
                                                                                                                                                        
                                                        |  | @@ -4911,11 +4911,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4911 | 4911 |  	{ | 
                                                                                                            
                                                            | 4912 | 4912 |  		global $langs, $user; | 
                                                                                                            
                                                            | 4913 | 4913 |   | 
                                                                                                            
                                                            | 4914 |  | -		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 4914 | +		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); | 
                                                                                                            
                                                            | 4915 | 4915 |   | 
                                                                                                            
                                                            | 4916 | 4916 |  		$this->load_cache_transport_mode(); | 
                                                                                                            
                                                            | 4917 | 4917 |   | 
                                                                                                            
                                                            | 4918 |  | -		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 4918 | +		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 4919 | 4919 |  		if ($empty) { | 
                                                                                                            
                                                            | 4920 | 4920 |  			print '<option value=""> </option>'; | 
                                                                                                            
                                                            | 4921 | 4921 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -4931,13 +4931,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4931 | 4931 |  			} | 
                                                                                                            
                                                            | 4932 | 4932 |   | 
                                                                                                            
                                                            | 4933 | 4933 |  			if ($format == 0) { | 
                                                                                                            
                                                            | 4934 |  | -				print '<option value="' . $id . '"'; | 
                                                                                                            
                                                            |  | 4934 | +				print '<option value="'.$id.'"'; | 
                                                                                                            
                                                            | 4935 | 4935 |  			} elseif ($format == 1) { | 
                                                                                                            
                                                            | 4936 |  | -				print '<option value="' . $arraytypes['code'] . '"'; | 
                                                                                                            
                                                            |  | 4936 | +				print '<option value="'.$arraytypes['code'].'"'; | 
                                                                                                            
                                                            | 4937 | 4937 |  			} elseif ($format == 2) { | 
                                                                                                            
                                                            | 4938 |  | -				print '<option value="' . $arraytypes['code'] . '"'; | 
                                                                                                            
                                                            |  | 4938 | +				print '<option value="'.$arraytypes['code'].'"'; | 
                                                                                                            
                                                            | 4939 | 4939 |  			} elseif ($format == 3) { | 
                                                                                                            
                                                            | 4940 |  | -				print '<option value="' . $id . '"'; | 
                                                                                                            
                                                            |  | 4940 | +				print '<option value="'.$id.'"'; | 
                                                                                                            
                                                            | 4941 | 4941 |  			} | 
                                                                                                            
                                                            | 4942 | 4942 |  			// If text is selected, we compare with code, else with id | 
                                                                                                            
                                                            | 4943 | 4943 |  			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { | 
                                                                                                                                                        
                                                        |  | @@ -4988,31 +4988,31 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 4988 | 4988 |  		$langs->load("deliveries"); | 
                                                                                                            
                                                            | 4989 | 4989 |   | 
                                                                                                            
                                                            | 4990 | 4990 |  		$sql = "SELECT rowid, code, libelle as label"; | 
                                                                                                            
                                                            | 4991 |  | -		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; | 
                                                                                                            
                                                            |  | 4991 | +		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; | 
                                                                                                            
                                                            | 4992 | 4992 |  		$sql .= " WHERE active > 0"; | 
                                                                                                            
                                                            | 4993 | 4993 |  		if ($filtre) { | 
                                                                                                            
                                                            | 4994 |  | -			$sql .= " AND " . $filtre; | 
                                                                                                            
                                                            |  | 4994 | +			$sql .= " AND ".$filtre; | 
                                                                                                            
                                                            | 4995 | 4995 |  		} | 
                                                                                                            
                                                            | 4996 | 4996 |  		$sql .= " ORDER BY libelle ASC"; | 
                                                                                                            
                                                            | 4997 | 4997 |   | 
                                                                                                            
                                                            | 4998 |  | -		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 4998 | +		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); | 
                                                                                                            
                                                            | 4999 | 4999 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 5000 | 5000 |  		if ($result) { | 
                                                                                                            
                                                            | 5001 | 5001 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 5002 | 5002 |  			$i = 0; | 
                                                                                                            
                                                            | 5003 | 5003 |  			if ($num) { | 
                                                                                                            
                                                            | 5004 |  | -				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; | 
                                                                                                            
                                                            |  | 5004 | +				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; | 
                                                                                                            
                                                            | 5005 | 5005 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                                                                            
                                                            | 5006 | 5006 |  					print '<option value="-1"> </option>'; | 
                                                                                                            
                                                            | 5007 | 5007 |  				} | 
                                                                                                            
                                                            | 5008 | 5008 |  				while ($i < $num) { | 
                                                                                                            
                                                            | 5009 | 5009 |  					$obj = $this->db->fetch_object($result); | 
                                                                                                            
                                                            | 5010 | 5010 |  					if ($selected == $obj->rowid) { | 
                                                                                                            
                                                            | 5011 |  | -						print '<option value="' . $obj->rowid . '" selected>'; | 
                                                                                                            
                                                            |  | 5011 | +						print '<option value="'.$obj->rowid.'" selected>'; | 
                                                                                                            
                                                            | 5012 | 5012 |  					} else { | 
                                                                                                            
                                                            | 5013 |  | -						print '<option value="' . $obj->rowid . '">'; | 
                                                                                                            
                                                            |  | 5013 | +						print '<option value="'.$obj->rowid.'">'; | 
                                                                                                            
                                                            | 5014 | 5014 |  					} | 
                                                                                                            
                                                            | 5015 |  | -					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; | 
                                                                                                            
                                                            |  | 5015 | +					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; | 
                                                                                                            
                                                            | 5016 | 5016 |  					print '</option>'; | 
                                                                                                            
                                                            | 5017 | 5017 |  					$i++; | 
                                                                                                            
                                                            | 5018 | 5018 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -5021,7 +5021,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5021 | 5021 |  					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                                                                            
                                                            | 5022 | 5022 |  				} | 
                                                                                                            
                                                            | 5023 | 5023 |   | 
                                                                                                            
                                                            | 5024 |  | -				print ajax_combobox('select' . $htmlname); | 
                                                                                                            
                                                            |  | 5024 | +				print ajax_combobox('select'.$htmlname); | 
                                                                                                            
                                                            | 5025 | 5025 |  			} else { | 
                                                                                                            
                                                            | 5026 | 5026 |  				print $langs->trans("NoShippingMethodDefined"); | 
                                                                                                            
                                                            | 5027 | 5027 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -5046,16 +5046,16 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5046 | 5046 |  		$langs->load("deliveries"); | 
                                                                                                            
                                                            | 5047 | 5047 |   | 
                                                                                                            
                                                            | 5048 | 5048 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 5049 |  | -			print '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 5049 | +			print '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 5050 | 5050 |  			print '<input type="hidden" name="action" value="setshippingmethod">'; | 
                                                                                                            
                                                            | 5051 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 5051 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 5052 | 5052 |  			$this->selectShippingMethod($selected, $htmlname, '', $addempty); | 
                                                                                                            
                                                            | 5053 |  | -			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 5053 | +			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 5054 | 5054 |  			print '</form>'; | 
                                                                                                            
                                                            | 5055 | 5055 |  		} else { | 
                                                                                                            
                                                            | 5056 | 5056 |  			if ($selected) { | 
                                                                                                            
                                                            | 5057 | 5057 |  				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); | 
                                                                                                            
                                                            | 5058 |  | -				print $langs->trans("SendingMethod" . strtoupper($code)); | 
                                                                                                            
                                                            |  | 5058 | +				print $langs->trans("SendingMethod".strtoupper($code)); | 
                                                                                                            
                                                            | 5059 | 5059 |  			} else { | 
                                                                                                            
                                                            | 5060 | 5060 |  				print " "; | 
                                                                                                            
                                                            | 5061 | 5061 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -5078,10 +5078,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5078 | 5078 |   | 
                                                                                                            
                                                            | 5079 | 5079 |  		$opt = '<option value="" selected></option>'; | 
                                                                                                            
                                                            | 5080 | 5080 |  		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; | 
                                                                                                            
                                                            | 5081 |  | -		$sql .= ' FROM ' . $this->db->prefix() . 'facture'; | 
                                                                                                            
                                                            | 5082 |  | -		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; | 
                                                                                                            
                                                            |  | 5081 | +		$sql .= ' FROM '.$this->db->prefix().'facture'; | 
                                                                                                            
                                                            |  | 5082 | +		$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; | 
                                                                                                            
                                                            | 5083 | 5083 |  		$sql .= ' AND situation_counter >= 1'; | 
                                                                                                            
                                                            | 5084 |  | -		$sql .= ' AND fk_soc = ' . (int) $socid; | 
                                                                                                            
                                                            |  | 5084 | +		$sql .= ' AND fk_soc = '.(int) $socid; | 
                                                                                                            
                                                            | 5085 | 5085 |  		$sql .= ' AND type <> 2'; | 
                                                                                                            
                                                            | 5086 | 5086 |  		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; | 
                                                                                                            
                                                            | 5087 | 5087 |  		$resql = $this->db->query($sql); | 
                                                                                                                                                        
                                                        |  | @@ -5099,19 +5099,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5099 | 5099 |  						//Not prov? | 
                                                                                                            
                                                            | 5100 | 5100 |  						if (substr($obj->ref, 1, 4) != 'PROV') { | 
                                                                                                            
                                                            | 5101 | 5101 |  							if ($selected == $obj->rowid) { | 
                                                                                                            
                                                            | 5102 |  | -								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; | 
                                                                                                            
                                                            |  | 5102 | +								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; | 
                                                                                                            
                                                            | 5103 | 5103 |  							} else { | 
                                                                                                            
                                                            | 5104 |  | -								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; | 
                                                                                                            
                                                            |  | 5104 | +								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; | 
                                                                                                            
                                                            | 5105 | 5105 |  							} | 
                                                                                                            
                                                            | 5106 | 5106 |  						} | 
                                                                                                            
                                                            | 5107 | 5107 |  					} | 
                                                                                                            
                                                            | 5108 | 5108 |  				} | 
                                                                                                            
                                                            | 5109 | 5109 |  			} | 
                                                                                                            
                                                            | 5110 | 5110 |  		} else { | 
                                                                                                            
                                                            | 5111 |  | -			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); | 
                                                                                                            
                                                            |  | 5111 | +			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); | 
                                                                                                            
                                                            | 5112 | 5112 |  		} | 
                                                                                                            
                                                            | 5113 | 5113 |  		if ($opt == '<option value ="" selected></option>') { | 
                                                                                                            
                                                            | 5114 |  | -			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; | 
                                                                                                            
                                                            |  | 5114 | +			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; | 
                                                                                                            
                                                            | 5115 | 5115 |  		} | 
                                                                                                            
                                                            | 5116 | 5116 |  		return $opt; | 
                                                                                                            
                                                            | 5117 | 5117 |  	} | 
                                                                                                                                                        
                                                        |  | @@ -5131,12 +5131,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5131 | 5131 |   | 
                                                                                                            
                                                            | 5132 | 5132 |  		$langs->load('products'); | 
                                                                                                            
                                                            | 5133 | 5133 |   | 
                                                                                                            
                                                            | 5134 |  | -		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 5134 | +		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 5135 | 5135 |   | 
                                                                                                            
                                                            | 5136 |  | -		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; | 
                                                                                                            
                                                            |  | 5136 | +		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; | 
                                                                                                            
                                                            | 5137 | 5137 |  		$sql .= ' WHERE active > 0'; | 
                                                                                                            
                                                            | 5138 | 5138 |  		if (!empty($unit_type)) { | 
                                                                                                            
                                                            | 5139 |  | -			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; | 
                                                                                                            
                                                            |  | 5139 | +			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; | 
                                                                                                            
                                                            | 5140 | 5140 |  		} | 
                                                                                                            
                                                            | 5141 | 5141 |  		$sql .= " ORDER BY sortorder"; | 
                                                                                                            
                                                            | 5142 | 5142 |   | 
                                                                                                                                                        
                                                        |  | @@ -5148,14 +5148,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5148 | 5148 |   | 
                                                                                                            
                                                            | 5149 | 5149 |  			while ($res = $this->db->fetch_object($resql)) { | 
                                                                                                            
                                                            | 5150 | 5150 |  				$unitLabel = $res->label; | 
                                                                                                            
                                                            | 5151 |  | -				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before | 
                                                                                                            
                                                            | 5152 |  | -					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; | 
                                                                                                            
                                                            |  | 5151 | +				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before | 
                                                                                                            
                                                            |  | 5152 | +					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; | 
                                                                                                            
                                                            | 5153 | 5153 |  				} | 
                                                                                                            
                                                            | 5154 | 5154 |   | 
                                                                                                            
                                                            | 5155 | 5155 |  				if ($selected == $res->rowid) { | 
                                                                                                            
                                                            | 5156 |  | -					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; | 
                                                                                                            
                                                            |  | 5156 | +					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; | 
                                                                                                            
                                                            | 5157 | 5157 |  				} else { | 
                                                                                                            
                                                            | 5158 |  | -					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; | 
                                                                                                            
                                                            |  | 5158 | +					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; | 
                                                                                                            
                                                            | 5159 | 5159 |  				} | 
                                                                                                            
                                                            | 5160 | 5160 |  			} | 
                                                                                                            
                                                            | 5161 | 5161 |  			$return .= '</select>'; | 
                                                                                                                                                        
                                                        |  | @@ -5192,29 +5192,29 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5192 | 5192 |  		$num = 0; | 
                                                                                                            
                                                            | 5193 | 5193 |   | 
                                                                                                            
                                                            | 5194 | 5194 |  		$sql = "SELECT rowid, label, bank, clos as status, currency_code"; | 
                                                                                                            
                                                            | 5195 |  | -		$sql .= " FROM " . $this->db->prefix() . "bank_account"; | 
                                                                                                            
                                                            | 5196 |  | -		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; | 
                                                                                                            
                                                            |  | 5195 | +		$sql .= " FROM ".$this->db->prefix()."bank_account"; | 
                                                                                                            
                                                            |  | 5196 | +		$sql .= " WHERE entity IN (".getEntity('bank_account').")"; | 
                                                                                                            
                                                            | 5197 | 5197 |  		if ($status != 2) { | 
                                                                                                            
                                                            | 5198 |  | -			$sql .= " AND clos = " . (int) $status; | 
                                                                                                            
                                                            |  | 5198 | +			$sql .= " AND clos = ".(int) $status; | 
                                                                                                            
                                                            | 5199 | 5199 |  		} | 
                                                                                                            
                                                            | 5200 | 5200 |  		if ($filtre) {	// TODO Support USF | 
                                                                                                            
                                                            | 5201 |  | -			$sql .= " AND " . $filtre; | 
                                                                                                            
                                                            |  | 5201 | +			$sql .= " AND ".$filtre; | 
                                                                                                            
                                                            | 5202 | 5202 |  		} | 
                                                                                                            
                                                            | 5203 | 5203 |  		$sql .= " ORDER BY label"; | 
                                                                                                            
                                                            | 5204 | 5204 |   | 
                                                                                                            
                                                            | 5205 |  | -		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 5205 | +		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); | 
                                                                                                            
                                                            | 5206 | 5206 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 5207 | 5207 |  		if ($result) { | 
                                                                                                            
                                                            | 5208 | 5208 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 5209 | 5209 |  			$i = 0; | 
                                                                                                            
                                                            | 5210 | 5210 |   | 
                                                                                                            
                                                            | 5211 |  | -			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; | 
                                                                                                            
                                                            |  | 5211 | +			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; | 
                                                                                                            
                                                            | 5212 | 5212 |   | 
                                                                                                            
                                                            | 5213 | 5213 |  			if ($num == 0) { | 
                                                                                                            
                                                            | 5214 | 5214 |  				if ($status == 0) { | 
                                                                                                            
                                                            | 5215 |  | -					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; | 
                                                                                                            
                                                            |  | 5215 | +					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; | 
                                                                                                            
                                                            | 5216 | 5216 |  				} else { | 
                                                                                                            
                                                            | 5217 |  | -					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>'; | 
                                                                                                            
                                                            |  | 5217 | +					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>'; | 
                                                                                                            
                                                            | 5218 | 5218 |  				} | 
                                                                                                            
                                                            | 5219 | 5219 |  			} else { | 
                                                                                                            
                                                            | 5220 | 5220 |  				if (!empty($useempty) && !is_numeric($useempty)) { | 
                                                                                                                                                        
                                                        |  | @@ -5230,25 +5230,25 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5230 | 5230 |  				$labeltoshow = trim($obj->label); | 
                                                                                                            
                                                            | 5231 | 5231 |  				$labeltoshowhtml = trim($obj->label); | 
                                                                                                            
                                                            | 5232 | 5232 |  				if ($showcurrency) { | 
                                                                                                            
                                                            | 5233 |  | -					$labeltoshow .= ' (' . $obj->currency_code . ')'; | 
                                                                                                            
                                                            | 5234 |  | -					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->currency_code . ')</span>'; | 
                                                                                                            
                                                            |  | 5233 | +					$labeltoshow .= ' ('.$obj->currency_code.')'; | 
                                                                                                            
                                                            |  | 5234 | +					$labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->currency_code.')</span>'; | 
                                                                                                            
                                                            | 5235 | 5235 |  				} | 
                                                                                                            
                                                            | 5236 | 5236 |  				if ($status == 2 && $obj->status == 1) { | 
                                                                                                            
                                                            | 5237 |  | -					$labeltoshow .= ' (' . $langs->trans("Closed") . ')'; | 
                                                                                                            
                                                            | 5238 |  | -					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $langs->trans("Closed") . ')</span>'; | 
                                                                                                            
                                                            |  | 5237 | +					$labeltoshow .= ' ('.$langs->trans("Closed").')'; | 
                                                                                                            
                                                            |  | 5238 | +					$labeltoshowhtml .= ' <span class="opacitymedium">('.$langs->trans("Closed").')</span>'; | 
                                                                                                            
                                                            | 5239 | 5239 |  				} | 
                                                                                                            
                                                            | 5240 | 5240 |   | 
                                                                                                            
                                                            | 5241 | 5241 |  				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                                                                            
                                                            | 5242 |  | -					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>'; | 
                                                                                                            
                                                            |  | 5242 | +					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>'; | 
                                                                                                            
                                                            | 5243 | 5243 |  				} else { | 
                                                                                                            
                                                            | 5244 |  | -					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">'; | 
                                                                                                            
                                                            |  | 5244 | +					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">'; | 
                                                                                                            
                                                            | 5245 | 5245 |  				} | 
                                                                                                            
                                                            | 5246 | 5246 |  				$out .= $labeltoshow; | 
                                                                                                            
                                                            | 5247 | 5247 |  				$out .= '</option>'; | 
                                                                                                            
                                                            | 5248 | 5248 |  				$i++; | 
                                                                                                            
                                                            | 5249 | 5249 |  			} | 
                                                                                                            
                                                            | 5250 | 5250 |  			$out .= "</select>"; | 
                                                                                                            
                                                            | 5251 |  | -			$out .= ajax_combobox('select' . $htmlname); | 
                                                                                                            
                                                            |  | 5251 | +			$out .= ajax_combobox('select'.$htmlname); | 
                                                                                                            
                                                            | 5252 | 5252 |  		} else { | 
                                                                                                            
                                                            | 5253 | 5253 |  			dol_print_error($this->db); | 
                                                                                                            
                                                            | 5254 | 5254 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -5287,22 +5287,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5287 | 5287 |  		$num = 0; | 
                                                                                                            
                                                            | 5288 | 5288 |   | 
                                                                                                            
                                                            | 5289 | 5289 |  		$sql = "SELECT rowid, label, bank, status, iban_prefix, bic"; | 
                                                                                                            
                                                            | 5290 |  | -		$sql .= " FROM " . $this->db->prefix() . "societe_rib"; | 
                                                                                                            
                                                            | 5291 |  | -		$sql .=  " WHERE type = 'ban'"; | 
                                                                                                            
                                                            |  | 5290 | +		$sql .= " FROM ".$this->db->prefix()."societe_rib"; | 
                                                                                                            
                                                            |  | 5291 | +		$sql .= " WHERE type = 'ban'"; | 
                                                                                                            
                                                            | 5292 | 5292 |  		if ($filtre) {	// TODO Support USF | 
                                                                                                            
                                                            | 5293 |  | -			$sql .= " AND " . $filtre; | 
                                                                                                            
                                                            |  | 5293 | +			$sql .= " AND ".$filtre; | 
                                                                                                            
                                                            | 5294 | 5294 |  		} | 
                                                                                                            
                                                            | 5295 | 5295 |  		$sql .= " ORDER BY label"; | 
                                                                                                            
                                                            | 5296 |  | -		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 5296 | +		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); | 
                                                                                                            
                                                            | 5297 | 5297 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 5298 | 5298 |  		if ($result) { | 
                                                                                                            
                                                            | 5299 | 5299 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 5300 | 5300 |  			$i = 0; | 
                                                                                                            
                                                            | 5301 | 5301 |   | 
                                                                                                            
                                                            | 5302 |  | -			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; | 
                                                                                                            
                                                            |  | 5302 | +			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; | 
                                                                                                            
                                                            | 5303 | 5303 |   | 
                                                                                                            
                                                            | 5304 | 5304 |  			if ($num == 0) { | 
                                                                                                            
                                                            | 5305 |  | -				$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>'; | 
                                                                                                            
                                                            |  | 5305 | +				$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>'; | 
                                                                                                            
                                                            | 5306 | 5306 |  			} else { | 
                                                                                                            
                                                            | 5307 | 5307 |  				if (!empty($useempty) && !is_numeric($useempty)) { | 
                                                                                                            
                                                            | 5308 | 5308 |  					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>'; | 
                                                                                                                                                        
                                                        |  | @@ -5315,19 +5315,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5315 | 5315 |  				$obj = $this->db->fetch_object($result); | 
                                                                                                            
                                                            | 5316 | 5316 |  				$iban = dolDecrypt($obj->iban_prefix); | 
                                                                                                            
                                                            | 5317 | 5317 |  				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                                                                            
                                                            | 5318 |  | -					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '" selected>'; | 
                                                                                                            
                                                            |  | 5318 | +					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'" selected>'; | 
                                                                                                            
                                                            | 5319 | 5319 |  				} else { | 
                                                                                                            
                                                            | 5320 |  | -					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '">'; | 
                                                                                                            
                                                            |  | 5320 | +					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'">'; | 
                                                                                                            
                                                            | 5321 | 5321 |  				} | 
                                                                                                            
                                                            | 5322 | 5322 |  				$out .= trim($obj->label); | 
                                                                                                            
                                                            | 5323 | 5323 |  				if ($showibanbic) { | 
                                                                                                            
                                                            | 5324 |  | -					$out .= ' (' . $iban . '/' .$obj->bic. ')'; | 
                                                                                                            
                                                            |  | 5324 | +					$out .= ' ('.$iban.'/'.$obj->bic.')'; | 
                                                                                                            
                                                            | 5325 | 5325 |  				} | 
                                                                                                            
                                                            | 5326 | 5326 |  				$out .= '</option>'; | 
                                                                                                            
                                                            | 5327 | 5327 |  				$i++; | 
                                                                                                            
                                                            | 5328 | 5328 |  			} | 
                                                                                                            
                                                            | 5329 | 5329 |  			$out .= "</select>"; | 
                                                                                                            
                                                            | 5330 |  | -			$out .= ajax_combobox('select' . $htmlname); | 
                                                                                                            
                                                            |  | 5330 | +			$out .= ajax_combobox('select'.$htmlname); | 
                                                                                                            
                                                            | 5331 | 5331 |  		} else { | 
                                                                                                            
                                                            | 5332 | 5332 |  			dol_print_error($this->db); | 
                                                                                                            
                                                            | 5333 | 5333 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -5361,23 +5361,23 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5361 | 5361 |  		$num = 0; | 
                                                                                                            
                                                            | 5362 | 5362 |   | 
                                                                                                            
                                                            | 5363 | 5363 |  		$sql = "SELECT rowid, name, fk_country, status, entity"; | 
                                                                                                            
                                                            | 5364 |  | -		$sql .= " FROM " . $this->db->prefix() . "establishment"; | 
                                                                                                            
                                                            |  | 5364 | +		$sql .= " FROM ".$this->db->prefix()."establishment"; | 
                                                                                                            
                                                            | 5365 | 5365 |  		$sql .= " WHERE 1=1"; | 
                                                                                                            
                                                            | 5366 | 5366 |  		if ($status != 2) { | 
                                                                                                            
                                                            | 5367 |  | -			$sql .= " AND status = " . (int) $status; | 
                                                                                                            
                                                            |  | 5367 | +			$sql .= " AND status = ".(int) $status; | 
                                                                                                            
                                                            | 5368 | 5368 |  		} | 
                                                                                                            
                                                            | 5369 | 5369 |  		if ($filtre) {	// TODO Support USF | 
                                                                                                            
                                                            | 5370 |  | -			$sql .= " AND " . $filtre; | 
                                                                                                            
                                                            |  | 5370 | +			$sql .= " AND ".$filtre; | 
                                                                                                            
                                                            | 5371 | 5371 |  		} | 
                                                                                                            
                                                            | 5372 | 5372 |  		$sql .= " ORDER BY name"; | 
                                                                                                            
                                                            | 5373 | 5373 |   | 
                                                                                                            
                                                            | 5374 |  | -		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 5374 | +		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); | 
                                                                                                            
                                                            | 5375 | 5375 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 5376 | 5376 |  		if ($result) { | 
                                                                                                            
                                                            | 5377 | 5377 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 5378 | 5378 |  			$i = 0; | 
                                                                                                            
                                                            | 5379 | 5379 |  			if ($num) { | 
                                                                                                            
                                                            | 5380 |  | -				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; | 
                                                                                                            
                                                            |  | 5380 | +				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; | 
                                                                                                            
                                                            | 5381 | 5381 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                                                                            
                                                            | 5382 | 5382 |  					print '<option value="-1"> </option>'; | 
                                                                                                            
                                                            | 5383 | 5383 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -5385,13 +5385,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5385 | 5385 |  				while ($i < $num) { | 
                                                                                                            
                                                            | 5386 | 5386 |  					$obj = $this->db->fetch_object($result); | 
                                                                                                            
                                                            | 5387 | 5387 |  					if ($selected == $obj->rowid) { | 
                                                                                                            
                                                            | 5388 |  | -						print '<option value="' . $obj->rowid . '" selected>'; | 
                                                                                                            
                                                            |  | 5388 | +						print '<option value="'.$obj->rowid.'" selected>'; | 
                                                                                                            
                                                            | 5389 | 5389 |  					} else { | 
                                                                                                            
                                                            | 5390 |  | -						print '<option value="' . $obj->rowid . '">'; | 
                                                                                                            
                                                            |  | 5390 | +						print '<option value="'.$obj->rowid.'">'; | 
                                                                                                            
                                                            | 5391 | 5391 |  					} | 
                                                                                                            
                                                            | 5392 | 5392 |  					print trim($obj->name); | 
                                                                                                            
                                                            | 5393 | 5393 |  					if ($status == 2 && $obj->status == 1) { | 
                                                                                                            
                                                            | 5394 |  | -						print ' (' . $langs->trans("Closed") . ')'; | 
                                                                                                            
                                                            |  | 5394 | +						print ' ('.$langs->trans("Closed").')'; | 
                                                                                                            
                                                            | 5395 | 5395 |  					} | 
                                                                                                            
                                                            | 5396 | 5396 |  					print '</option>'; | 
                                                                                                            
                                                            | 5397 | 5397 |  					$i++; | 
                                                                                                                                                        
                                                        |  | @@ -5399,9 +5399,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5399 | 5399 |  				print "</select>"; | 
                                                                                                            
                                                            | 5400 | 5400 |  			} else { | 
                                                                                                            
                                                            | 5401 | 5401 |  				if ($status == 0) { | 
                                                                                                            
                                                            | 5402 |  | -					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; | 
                                                                                                            
                                                            |  | 5402 | +					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; | 
                                                                                                            
                                                            | 5403 | 5403 |  				} else { | 
                                                                                                            
                                                            | 5404 |  | -					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; | 
                                                                                                            
                                                            |  | 5404 | +					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; | 
                                                                                                            
                                                            | 5405 | 5405 |  				} | 
                                                                                                            
                                                            | 5406 | 5406 |  			} | 
                                                                                                            
                                                            | 5407 | 5407 |   | 
                                                                                                                                                        
                                                        |  | @@ -5425,20 +5425,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5425 | 5425 |  	{ | 
                                                                                                            
                                                            | 5426 | 5426 |  		global $langs; | 
                                                                                                            
                                                            | 5427 | 5427 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 5428 |  | -			print '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 5428 | +			print '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 5429 | 5429 |  			print '<input type="hidden" name="action" value="setbankaccount">'; | 
                                                                                                            
                                                            | 5430 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 5430 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 5431 | 5431 |  			print img_picto('', 'bank_account', 'class="pictofixedwidth"'); | 
                                                                                                            
                                                            | 5432 | 5432 |  			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); | 
                                                                                                            
                                                            | 5433 | 5433 |  			if ($nbaccountfound > 0) { | 
                                                                                                            
                                                            | 5434 |  | -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 5434 | +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 5435 | 5435 |  			} | 
                                                                                                            
                                                            | 5436 | 5436 |  			print '</form>'; | 
                                                                                                            
                                                            | 5437 | 5437 |  		} else { | 
                                                                                                            
                                                            | 5438 | 5438 |  			$langs->load('banks'); | 
                                                                                                            
                                                            | 5439 | 5439 |   | 
                                                                                                            
                                                            | 5440 | 5440 |  			if ($selected) { | 
                                                                                                            
                                                            | 5441 |  | -				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; | 
                                                                                                            
                                                            |  | 5441 | +				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; | 
                                                                                                            
                                                            | 5442 | 5442 |  				$bankstatic = new Account($this->db); | 
                                                                                                            
                                                            | 5443 | 5443 |  				$result = $bankstatic->fetch($selected); | 
                                                                                                            
                                                            | 5444 | 5444 |  				if ($result) { | 
                                                                                                                                                        
                                                        |  | @@ -5465,25 +5465,25 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5465 | 5465 |  	{ | 
                                                                                                            
                                                            | 5466 | 5466 |  		global $langs; | 
                                                                                                            
                                                            | 5467 | 5467 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 5468 |  | -			print '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 5468 | +			print '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 5469 | 5469 |  			print '<input type="hidden" name="action" value="setbankaccountcustomer">'; | 
                                                                                                            
                                                            | 5470 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 5470 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 5471 | 5471 |  			$nbaccountfound = $this->selectRib($selected, $htmlname, $filtre, $addempty, '', $showibanbic); | 
                                                                                                            
                                                            | 5472 | 5472 |  			if ($nbaccountfound > 0) { | 
                                                                                                            
                                                            | 5473 |  | -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 5473 | +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 5474 | 5474 |  			} | 
                                                                                                            
                                                            | 5475 | 5475 |  			print '</form>'; | 
                                                                                                            
                                                            | 5476 | 5476 |  		} else { | 
                                                                                                            
                                                            | 5477 | 5477 |  			$langs->load('banks'); | 
                                                                                                            
                                                            | 5478 | 5478 |   | 
                                                                                                            
                                                            | 5479 | 5479 |  			if ($selected) { | 
                                                                                                            
                                                            | 5480 |  | -				require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; | 
                                                                                                            
                                                            |  | 5480 | +				require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; | 
                                                                                                            
                                                            | 5481 | 5481 |  				$bankstatic = new CompanyBankAccount($this->db); | 
                                                                                                            
                                                            | 5482 | 5482 |  				$result = $bankstatic->fetch($selected); | 
                                                                                                            
                                                            | 5483 | 5483 |  				if ($result) { | 
                                                                                                            
                                                            | 5484 | 5484 |  					print $bankstatic->label; | 
                                                                                                            
                                                            | 5485 | 5485 |  					if ($showibanbic) { | 
                                                                                                            
                                                            | 5486 |  | -						print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')'; | 
                                                                                                            
                                                            |  | 5486 | +						print ' ('.$bankstatic->iban.'/'.$bankstatic->bic.')'; | 
                                                                                                            
                                                            | 5487 | 5487 |  					} | 
                                                                                                            
                                                            | 5488 | 5488 |  				} | 
                                                                                                            
                                                            | 5489 | 5489 |  			} else { | 
                                                                                                                                                        
                                                        |  | @@ -5519,11 +5519,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5519 | 5519 |  		global $conf, $langs; | 
                                                                                                            
                                                            | 5520 | 5520 |  		$langs->load("categories"); | 
                                                                                                            
                                                            | 5521 | 5521 |   | 
                                                                                                            
                                                            | 5522 |  | -		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; | 
                                                                                                            
                                                            |  | 5522 | +		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; | 
                                                                                                            
                                                            | 5523 | 5523 |   | 
                                                                                                            
                                                            | 5524 | 5524 |  		// For backward compatibility | 
                                                                                                            
                                                            | 5525 | 5525 |  		if (is_numeric($type)) { | 
                                                                                                            
                                                            | 5526 |  | -			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); | 
                                                                                                            
                                                            |  | 5526 | +			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); | 
                                                                                                            
                                                            | 5527 | 5527 |  		} | 
                                                                                                            
                                                            | 5528 | 5528 |   | 
                                                                                                            
                                                            | 5529 | 5529 |  		if ($type === Categorie::TYPE_BANK_LINE) { | 
                                                                                                                                                        
                                                        |  | @@ -5531,8 +5531,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5531 | 5531 |  			$cat = new Categorie($this->db); | 
                                                                                                            
                                                            | 5532 | 5532 |  			$cate_arbo = array(); | 
                                                                                                            
                                                            | 5533 | 5533 |  			$sql = "SELECT c.label, c.rowid"; | 
                                                                                                            
                                                            | 5534 |  | -			$sql .= " FROM " . $this->db->prefix() . "categorie as c"; | 
                                                                                                            
                                                            | 5535 |  | -			$sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]); | 
                                                                                                            
                                                            |  | 5534 | +			$sql .= " FROM ".$this->db->prefix()."categorie as c"; | 
                                                                                                            
                                                            |  | 5535 | +			$sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]); | 
                                                                                                            
                                                            | 5536 | 5536 |  			$sql .= " ORDER BY c.label"; | 
                                                                                                            
                                                            | 5537 | 5537 |  			$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 5538 | 5538 |  			if ($result) { | 
                                                                                                                                                        
                                                        |  | @@ -5558,12 +5558,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5558 | 5558 |  		$outarrayrichhtml = array(); | 
                                                                                                            
                                                            | 5559 | 5559 |   | 
                                                                                                            
                                                            | 5560 | 5560 |   | 
                                                                                                            
                                                            | 5561 |  | -		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 5561 | +		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 5562 | 5562 |  		if (is_array($cate_arbo)) { | 
                                                                                                            
                                                            | 5563 | 5563 |  			$num = count($cate_arbo); | 
                                                                                                            
                                                            | 5564 | 5564 |   | 
                                                                                                            
                                                            | 5565 | 5565 |  			if (!$num) { | 
                                                                                                            
                                                            | 5566 |  | -				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; | 
                                                                                                            
                                                            |  | 5566 | +				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; | 
                                                                                                            
                                                            | 5567 | 5567 |  			} else { | 
                                                                                                            
                                                            | 5568 | 5568 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                                                                            
                                                            | 5569 | 5569 |  					$output .= '<option value="-1"> </option>'; | 
                                                                                                                                                        
                                                        |  | @@ -5575,15 +5575,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5575 | 5575 |  						$add = ''; | 
                                                                                                            
                                                            | 5576 | 5576 |  					} | 
                                                                                                            
                                                            | 5577 | 5577 |   | 
                                                                                                            
                                                            | 5578 |  | -					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); | 
                                                                                                            
                                                            |  | 5578 | +					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); | 
                                                                                                            
                                                            | 5579 | 5579 |  					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); | 
                                                                                                            
                                                            | 5580 | 5580 |   | 
                                                                                                            
                                                            | 5581 | 5581 |  					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; | 
                                                                                                            
                                                            | 5582 | 5582 |   | 
                                                                                                            
                                                            | 5583 | 5583 |  					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; | 
                                                                                                            
                                                            | 5584 | 5584 |   | 
                                                                                                            
                                                            | 5585 |  | -					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; | 
                                                                                                            
                                                            | 5586 |  | -					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; | 
                                                                                                            
                                                            |  | 5585 | +					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; | 
                                                                                                            
                                                            |  | 5586 | +					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; | 
                                                                                                            
                                                            | 5587 | 5587 |  					$output .= '>'; | 
                                                                                                            
                                                            | 5588 | 5588 |  					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); | 
                                                                                                            
                                                            | 5589 | 5589 |  					$output .= '</option>'; | 
                                                                                                                                                        
                                                        |  | @@ -5629,7 +5629,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5629 | 5629 |  	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) | 
                                                                                                            
                                                            | 5630 | 5630 |  	{ | 
                                                                                                            
                                                            | 5631 | 5631 |  		// phpcs:enable | 
                                                                                                            
                                                            | 5632 |  | -		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); | 
                                                                                                            
                                                            |  | 5632 | +		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); | 
                                                                                                            
                                                            | 5633 | 5633 |  		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); | 
                                                                                                            
                                                            | 5634 | 5634 |  	} | 
                                                                                                            
                                                            | 5635 | 5635 |   | 
                                                                                                                                                        
                                                        |  | @@ -5664,7 +5664,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5664 | 5664 |  	{ | 
                                                                                                            
                                                            | 5665 | 5665 |  		global $langs, $conf; | 
                                                                                                            
                                                            | 5666 | 5666 |   | 
                                                                                                            
                                                            | 5667 |  | -		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; | 
                                                                                                            
                                                            |  | 5667 | +		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; | 
                                                                                                            
                                                            | 5668 | 5668 |  		$formconfirm = ''; | 
                                                                                                            
                                                            | 5669 | 5669 |  		$inputok = array(); | 
                                                                                                            
                                                            | 5670 | 5670 |  		$inputko = array(); | 
                                                                                                                                                        
                                                        |  | @@ -5688,27 +5688,27 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5688 | 5688 |  			foreach ($formquestion as $key => $input) { | 
                                                                                                            
                                                            | 5689 | 5689 |  				if (is_array($input) && !empty($input)) { | 
                                                                                                            
                                                            | 5690 | 5690 |  					if ($input['type'] == 'hidden') { | 
                                                                                                            
                                                            | 5691 |  | -						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); | 
                                                                                                            
                                                            | 5692 |  | -						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); | 
                                                                                                            
                                                            |  | 5691 | +						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); | 
                                                                                                            
                                                            |  | 5692 | +						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); | 
                                                                                                            
                                                            | 5693 | 5693 |   | 
                                                                                                            
                                                            | 5694 |  | -						$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"; | 
                                                                                                            
                                                            |  | 5694 | +						$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"; | 
                                                                                                            
                                                            | 5695 | 5695 |  					} | 
                                                                                                            
                                                            | 5696 | 5696 |  				} | 
                                                                                                            
                                                            | 5697 | 5697 |  			} | 
                                                                                                            
                                                            | 5698 | 5698 |   | 
                                                                                                            
                                                            | 5699 | 5699 |  			// Now add questions | 
                                                                                                            
                                                            | 5700 | 5700 |  			$moreonecolumn = ''; | 
                                                                                                            
                                                            | 5701 |  | -			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; | 
                                                                                                            
                                                            |  | 5701 | +			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; | 
                                                                                                            
                                                            | 5702 | 5702 |  			foreach ($formquestion as $key => $input) { | 
                                                                                                            
                                                            | 5703 | 5703 |  				if (is_array($input) && !empty($input)) { | 
                                                                                                            
                                                            | 5704 |  | -					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead. | 
                                                                                                            
                                                            | 5705 |  | -					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); | 
                                                                                                            
                                                            | 5706 |  | -					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); | 
                                                                                                            
                                                            |  | 5704 | +					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. | 
                                                                                                            
                                                            |  | 5705 | +					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); | 
                                                                                                            
                                                            |  | 5706 | +					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); | 
                                                                                                            
                                                            | 5707 | 5707 |   | 
                                                                                                            
                                                            | 5708 | 5708 |  					if ($input['type'] == 'text') { | 
                                                                                                            
                                                            | 5709 |  | -						$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"; | 
                                                                                                            
                                                            |  | 5709 | +						$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"; | 
                                                                                                            
                                                            | 5710 | 5710 |  					} elseif ($input['type'] == 'password') { | 
                                                                                                            
                                                            | 5711 |  | -						$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"; | 
                                                                                                            
                                                            |  | 5711 | +						$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"; | 
                                                                                                            
                                                            | 5712 | 5712 |  					} elseif ($input['type'] == 'textarea') { | 
                                                                                                            
                                                            | 5713 | 5713 |  						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; | 
                                                                                                            
                                                            | 5714 | 5714 |  						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; | 
                                                                                                                                                        
                                                        |  | @@ -5716,8 +5716,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5716 | 5716 |  						$more .= '</textarea>'; | 
                                                                                                            
                                                            | 5717 | 5717 |  						$more .= '</div></div>'."\n";*/ | 
                                                                                                            
                                                            | 5718 | 5718 |  						$moreonecolumn .= '<div class="margintoponly">'; | 
                                                                                                            
                                                            | 5719 |  | -						$moreonecolumn .= $input['label'] . '<br>'; | 
                                                                                                            
                                                            | 5720 |  | -						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; | 
                                                                                                            
                                                            |  | 5719 | +						$moreonecolumn .= $input['label'].'<br>'; | 
                                                                                                            
                                                            |  | 5720 | +						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; | 
                                                                                                            
                                                            | 5721 | 5721 |  						$moreonecolumn .= $input['value']; | 
                                                                                                            
                                                            | 5722 | 5722 |  						$moreonecolumn .= '</textarea>'; | 
                                                                                                            
                                                            | 5723 | 5723 |  						$moreonecolumn .= '</div>'; | 
                                                                                                                                                        
                                                        |  | @@ -5734,20 +5734,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5734 | 5734 |  						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; | 
                                                                                                            
                                                            | 5735 | 5735 |  						$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; | 
                                                                                                            
                                                            | 5736 | 5736 |   | 
                                                                                                            
                                                            | 5737 |  | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; | 
                                                                                                            
                                                            |  | 5737 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                                                                            
                                                            | 5738 | 5738 |  						if (!empty($input['label'])) { | 
                                                                                                            
                                                            | 5739 |  | -							$more .= $input['label'] . '</div><div class="tagtd left">'; | 
                                                                                                            
                                                            |  | 5739 | +							$more .= $input['label'].'</div><div class="tagtd left">'; | 
                                                                                                            
                                                            | 5740 | 5740 |  						} | 
                                                                                                            
                                                            | 5741 | 5741 |  						if ($input['type'] == 'select') { | 
                                                                                                            
                                                            | 5742 | 5742 |  							$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); | 
                                                                                                            
                                                            | 5743 | 5743 |  						} else { | 
                                                                                                            
                                                            | 5744 | 5744 |  							$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); | 
                                                                                                            
                                                            | 5745 | 5745 |  						} | 
                                                                                                            
                                                            | 5746 |  | -						$more .= '</div></div>' . "\n"; | 
                                                                                                            
                                                            |  | 5746 | +						$more .= '</div></div>'."\n"; | 
                                                                                                            
                                                            | 5747 | 5747 |  					} elseif ($input['type'] == 'checkbox') { | 
                                                                                                            
                                                            | 5748 | 5748 |  						$more .= '<div class="tagtr">'; | 
                                                                                                            
                                                            | 5749 |  | -						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; | 
                                                                                                            
                                                            | 5750 |  | -						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; | 
                                                                                                            
                                                            |  | 5749 | +						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; | 
                                                                                                            
                                                            |  | 5750 | +						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; | 
                                                                                                            
                                                            | 5751 | 5751 |  						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { | 
                                                                                                            
                                                            | 5752 | 5752 |  							$more .= ' checked'; | 
                                                                                                            
                                                            | 5753 | 5753 |  						} | 
                                                                                                                                                        
                                                        |  | @@ -5758,19 +5758,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5758 | 5758 |  							$more .= ' disabled'; | 
                                                                                                            
                                                            | 5759 | 5759 |  						} | 
                                                                                                            
                                                            | 5760 | 5760 |  						$more .= ' /></div>'; | 
                                                                                                            
                                                            | 5761 |  | -						$more .= '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 5761 | +						$more .= '</div>'."\n"; | 
                                                                                                            
                                                            | 5762 | 5762 |  					} elseif ($input['type'] == 'radio') { | 
                                                                                                            
                                                            | 5763 | 5763 |  						$i = 0; | 
                                                                                                            
                                                            | 5764 | 5764 |  						foreach ($input['values'] as $selkey => $selval) { | 
                                                                                                            
                                                            | 5765 | 5765 |  							$more .= '<div class="tagtr">'; | 
                                                                                                            
                                                            | 5766 | 5766 |  							if (isset($input['label'])) { | 
                                                                                                            
                                                            | 5767 | 5767 |  								if ($i == 0) { | 
                                                                                                            
                                                            | 5768 |  | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                                                                            
                                                            |  | 5768 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                                                                            
                                                            | 5769 | 5769 |  								} else { | 
                                                                                                            
                                                            | 5770 |  | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; | 
                                                                                                            
                                                            |  | 5770 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; | 
                                                                                                            
                                                            | 5771 | 5771 |  								} | 
                                                                                                            
                                                            | 5772 | 5772 |  							} | 
                                                                                                            
                                                            | 5773 |  | -							$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; | 
                                                                                                            
                                                            |  | 5773 | +							$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; | 
                                                                                                            
                                                            | 5774 | 5774 |  							if (!empty($input['disabled'])) { | 
                                                                                                            
                                                            | 5775 | 5775 |  								$more .= ' disabled'; | 
                                                                                                            
                                                            | 5776 | 5776 |  							} | 
                                                                                                                                                        
                                                        |  | @@ -5778,12 +5778,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5778 | 5778 |  								$more .= ' checked="checked"'; | 
                                                                                                            
                                                            | 5779 | 5779 |  							} | 
                                                                                                            
                                                            | 5780 | 5780 |  							$more .= ' /> '; | 
                                                                                                            
                                                            | 5781 |  | -							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; | 
                                                                                                            
                                                            | 5782 |  | -							$more .= '</div></div>' . "\n"; | 
                                                                                                            
                                                            |  | 5781 | +							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; | 
                                                                                                            
                                                            |  | 5782 | +							$more .= '</div></div>'."\n"; | 
                                                                                                            
                                                            | 5783 | 5783 |  							$i++; | 
                                                                                                            
                                                            | 5784 | 5784 |  						} | 
                                                                                                            
                                                            | 5785 | 5785 |  					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { | 
                                                                                                            
                                                            | 5786 |  | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                                                                            
                                                            |  | 5786 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                                                                            
                                                            | 5787 | 5787 |  						$more .= '<div class="tagtd">'; | 
                                                                                                            
                                                            | 5788 | 5788 |  						$addnowlink = (empty($input['datenow']) ? 0 : 1); | 
                                                                                                            
                                                            | 5789 | 5789 |  						$h = $m = 0; | 
                                                                                                                                                        
                                                        |  | @@ -5801,24 +5801,24 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5801 | 5801 |  					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not | 
                                                                                                            
                                                            | 5802 | 5802 |  						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                                                                            
                                                            | 5803 | 5803 |  						if (!empty($input['label'])) { | 
                                                                                                            
                                                            | 5804 |  | -							$more .= $input['label'] . '</div><div class="tagtd">'; | 
                                                                                                            
                                                            |  | 5804 | +							$more .= $input['label'].'</div><div class="tagtd">'; | 
                                                                                                            
                                                            | 5805 | 5805 |  						} | 
                                                                                                            
                                                            | 5806 | 5806 |  						$more .= $input['value']; | 
                                                                                                            
                                                            | 5807 |  | -						$more .= '</div></div>' . "\n"; | 
                                                                                                            
                                                            |  | 5807 | +						$more .= '</div></div>'."\n"; | 
                                                                                                            
                                                            | 5808 | 5808 |  					} elseif ($input['type'] == 'onecolumn') { | 
                                                                                                            
                                                            | 5809 | 5809 |  						$moreonecolumn .= '<div class="margintoponly">'; | 
                                                                                                            
                                                            | 5810 | 5810 |  						$moreonecolumn .= $input['value']; | 
                                                                                                            
                                                            | 5811 |  | -						$moreonecolumn .= '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 5811 | +						$moreonecolumn .= '</div>'."\n"; | 
                                                                                                            
                                                            | 5812 | 5812 |  					} elseif ($input['type'] == 'hidden') { | 
                                                                                                            
                                                            | 5813 | 5813 |  						// Do nothing more, already added by a previous loop | 
                                                                                                            
                                                            | 5814 | 5814 |  					} elseif ($input['type'] == 'separator') { | 
                                                                                                            
                                                            | 5815 | 5815 |  						$more .= '<br>'; | 
                                                                                                            
                                                            | 5816 | 5816 |  					} else { | 
                                                                                                            
                                                            | 5817 |  | -						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; | 
                                                                                                            
                                                            |  | 5817 | +						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; | 
                                                                                                            
                                                            | 5818 | 5818 |  					} | 
                                                                                                            
                                                            | 5819 | 5819 |  				} | 
                                                                                                            
                                                            | 5820 | 5820 |  			} | 
                                                                                                            
                                                            | 5821 |  | -			$more .= '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 5821 | +			$more .= '</div>'."\n"; | 
                                                                                                            
                                                            | 5822 | 5822 |  			$more .= $moreonecolumn; | 
                                                                                                            
                                                            | 5823 | 5823 |  		} | 
                                                                                                            
                                                            | 5824 | 5824 |   | 
                                                                                                                                                        
                                                        |  | @@ -5840,10 +5840,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5840 | 5840 |  				$button = $useajax; | 
                                                                                                            
                                                            | 5841 | 5841 |  				$useajax = 1; | 
                                                                                                            
                                                            | 5842 | 5842 |  				$autoOpen = false; | 
                                                                                                            
                                                            | 5843 |  | -				$dialogconfirm .= '-' . $button; | 
                                                                                                            
                                                            |  | 5843 | +				$dialogconfirm .= '-'.$button; | 
                                                                                                            
                                                            | 5844 | 5844 |  			} | 
                                                                                                            
                                                            | 5845 |  | -			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; | 
                                                                                                            
                                                            | 5846 |  | -			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); | 
                                                                                                            
                                                            |  | 5845 | +			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; | 
                                                                                                            
                                                            |  | 5846 | +			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); | 
                                                                                                            
                                                            | 5847 | 5847 |   | 
                                                                                                            
                                                            | 5848 | 5848 |  			// Add input fields into list of fields to read during submit (inputok and inputko) | 
                                                                                                            
                                                            | 5849 | 5849 |  			if (is_array($formquestion)) { | 
                                                                                                                                                        
                                                        |  | @@ -5866,24 +5866,24 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5866 | 5866 |  			} | 
                                                                                                            
                                                            | 5867 | 5867 |   | 
                                                                                                            
                                                            | 5868 | 5868 |  			// Show JQuery confirm box. | 
                                                                                                            
                                                            | 5869 |  | -			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; | 
                                                                                                            
                                                            |  | 5869 | +			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; | 
                                                                                                            
                                                            | 5870 | 5870 |  			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                                                                            
                                                            | 5871 |  | -				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 5871 | +				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; | 
                                                                                                            
                                                            | 5872 | 5872 |  			} | 
                                                                                                            
                                                            | 5873 | 5873 |  			if (!empty($more)) { | 
                                                                                                            
                                                            | 5874 |  | -				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 5874 | +				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; | 
                                                                                                            
                                                            | 5875 | 5875 |  			} | 
                                                                                                            
                                                            | 5876 |  | -			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); | 
                                                                                                            
                                                            | 5877 |  | -			$formconfirm .= '</div>' . "\n"; | 
                                                                                                            
                                                            |  | 5876 | +			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); | 
                                                                                                            
                                                            |  | 5877 | +			$formconfirm .= '</div>'."\n"; | 
                                                                                                            
                                                            | 5878 | 5878 |   | 
                                                                                                            
                                                            | 5879 |  | -			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; | 
                                                                                                            
                                                            | 5880 |  | -			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; | 
                                                                                                            
                                                            |  | 5879 | +			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; | 
                                                                                                            
                                                            |  | 5880 | +			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; | 
                                                                                                            
                                                            | 5881 | 5881 |  			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; | 
                                                                                                            
                                                            | 5882 | 5882 |  			$formconfirm .= 'jQuery(document).ready(function() { | 
                                                                                                            
                                                            | 5883 | 5883 |              $(function() { | 
                                                                                                            
                                                            | 5884 |  | -            	$( "#' . $dialogconfirm . '" ).dialog( | 
                                                                                                            
                                                            |  | 5884 | +            	$( "#' . $dialogconfirm.'" ).dialog( | 
                                                                                                            
                                                            | 5885 | 5885 |              	{ | 
                                                                                                            
                                                            | 5886 |  | -                    autoOpen: ' . ($autoOpen ? "true" : "false") . ','; | 
                                                                                                            
                                                            |  | 5886 | +                    autoOpen: ' . ($autoOpen ? "true" : "false").','; | 
                                                                                                            
                                                            | 5887 | 5887 |  			if ($newselectedchoice == 'no') { | 
                                                                                                            
                                                            | 5888 | 5888 |  				$formconfirm .= ' | 
                                                                                                            
                                                            | 5889 | 5889 |  						open: function() { | 
                                                                                                                                                        
                                                        |  | @@ -5893,24 +5893,24 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5893 | 5893 |   | 
                                                                                                            
                                                            | 5894 | 5894 |  			$jsforcursor = ''; | 
                                                                                                            
                                                            | 5895 | 5895 |  			if ($useajax == 1) { | 
                                                                                                            
                                                            | 5896 |  | -				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; | 
                                                                                                            
                                                            | 5897 |  | -				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; | 
                                                                                                            
                                                            |  | 5896 | +				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; | 
                                                                                                            
                                                            |  | 5897 | +				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; | 
                                                                                                            
                                                            | 5898 | 5898 |  			} | 
                                                                                                            
                                                            | 5899 | 5899 |   | 
                                                                                                            
                                                            | 5900 | 5900 |  			$postconfirmas = 'GET'; | 
                                                                                                            
                                                            | 5901 | 5901 |   | 
                                                                                                            
                                                            | 5902 | 5902 |  			$formconfirm .= ' | 
                                                                                                            
                                                            | 5903 | 5903 |                      resizable: false, | 
                                                                                                            
                                                            | 5904 |  | -                    height: "' . $height . '", | 
                                                                                                            
                                                            | 5905 |  | -                    width: "' . $width . '", | 
                                                                                                            
                                                            |  | 5904 | +                    height: "' . $height.'", | 
                                                                                                            
                                                            |  | 5905 | +                    width: "' . $width.'", | 
                                                                                                            
                                                            | 5906 | 5906 |                      modal: true, | 
                                                                                                            
                                                            | 5907 | 5907 |                      closeOnEscape: false, | 
                                                                                                            
                                                            | 5908 | 5908 |                      buttons: { | 
                                                                                                            
                                                            | 5909 |  | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { | 
                                                                                                            
                                                            | 5910 |  | -							var options = "token=' . urlencode(newToken()) . '"; | 
                                                                                                            
                                                            | 5911 |  | -                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */ | 
                                                                                                            
                                                            | 5912 |  | -							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; | 
                                                                                                            
                                                            | 5913 |  | -                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; | 
                                                                                                            
                                                            |  | 5909 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { | 
                                                                                                            
                                                            |  | 5910 | +							var options = "token=' . urlencode(newToken()).'"; | 
                                                                                                            
                                                            |  | 5911 | +                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */ | 
                                                                                                            
                                                            |  | 5912 | +							var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; | 
                                                                                                            
                                                            |  | 5913 | +                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; | 
                                                                                                            
                                                            | 5914 | 5914 |   | 
                                                                                                            
                                                            | 5915 | 5915 |                           	if (inputok.length > 0) { | 
                                                                                                            
                                                            | 5916 | 5916 |                           		$.each(inputok, function(i, inputname) { | 
                                                                                                                                                        
                                                        |  | @@ -5944,11 +5944,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5944 | 5944 |  							} | 
                                                                                                            
                                                            | 5945 | 5945 |  	                        $(this).dialog("close"); | 
                                                                                                            
                                                            | 5946 | 5946 |                          }, | 
                                                                                                            
                                                            | 5947 |  | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { | 
                                                                                                            
                                                            | 5948 |  | -                        	var options = "token=' . urlencode(newToken()) . '"; | 
                                                                                                            
                                                            | 5949 |  | -                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */ | 
                                                                                                            
                                                            | 5950 |  | -							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; | 
                                                                                                            
                                                            | 5951 |  | -                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; | 
                                                                                                            
                                                            |  | 5947 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { | 
                                                                                                            
                                                            |  | 5948 | +                        	var options = "token=' . urlencode(newToken()).'"; | 
                                                                                                            
                                                            |  | 5949 | +                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */ | 
                                                                                                            
                                                            |  | 5950 | +							var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; | 
                                                                                                            
                                                            |  | 5951 | +                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; | 
                                                                                                            
                                                            | 5952 | 5952 |                           	if (inputko.length > 0) { | 
                                                                                                            
                                                            | 5953 | 5953 |                           		$.each(inputko, function(i, inputname) { | 
                                                                                                            
                                                            | 5954 | 5954 |                           			var more = ""; | 
                                                                                                                                                        
                                                        |  | @@ -5980,10 +5980,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5980 | 5980 |                  } | 
                                                                                                            
                                                            | 5981 | 5981 |                  ); | 
                                                                                                            
                                                            | 5982 | 5982 |   | 
                                                                                                            
                                                            | 5983 |  | -            	var button = "' . $button . '"; | 
                                                                                                            
                                                            |  | 5983 | +            	var button = "' . $button.'"; | 
                                                                                                            
                                                            | 5984 | 5984 |              	if (button.length > 0) { | 
                                                                                                            
                                                            | 5985 | 5985 |                  	$( "#" + button ).click(function() { | 
                                                                                                            
                                                            | 5986 |  | -                		$("#' . $dialogconfirm . '").dialog("open"); | 
                                                                                                            
                                                            |  | 5986 | +                		$("#' . $dialogconfirm.'").dialog("open"); | 
                                                                                                            
                                                            | 5987 | 5987 |          			}); | 
                                                                                                            
                                                            | 5988 | 5988 |                  } | 
                                                                                                            
                                                            | 5989 | 5989 |              }); | 
                                                                                                                                                        
                                                        |  | @@ -5991,44 +5991,44 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 5991 | 5991 |              </script>'; | 
                                                                                                            
                                                            | 5992 | 5992 |  			$formconfirm .= "<!-- end ajax formconfirm -->\n"; | 
                                                                                                            
                                                            | 5993 | 5993 |  		} else { | 
                                                                                                            
                                                            | 5994 |  | -			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; | 
                                                                                                            
                                                            |  | 5994 | +			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; | 
                                                                                                            
                                                            | 5995 | 5995 |   | 
                                                                                                            
                                                            | 5996 | 5996 |  			if (empty($disableformtag)) { | 
                                                                                                            
                                                            | 5997 |  | -				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n"; | 
                                                                                                            
                                                            |  | 5997 | +				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n"; | 
                                                                                                            
                                                            | 5998 | 5998 |  			} | 
                                                                                                            
                                                            | 5999 | 5999 |   | 
                                                                                                            
                                                            | 6000 |  | -			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; | 
                                                                                                            
                                                            | 6001 |  | -			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; | 
                                                                                                            
                                                            |  | 6000 | +			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; | 
                                                                                                            
                                                            |  | 6001 | +			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; | 
                                                                                                            
                                                            | 6002 | 6002 |   | 
                                                                                                            
                                                            | 6003 |  | -			$formconfirm .= '<table class="valid centpercent">' . "\n"; | 
                                                                                                            
                                                            |  | 6003 | +			$formconfirm .= '<table class="valid centpercent">'."\n"; | 
                                                                                                            
                                                            | 6004 | 6004 |   | 
                                                                                                            
                                                            | 6005 | 6005 |  			// Line title | 
                                                                                                            
                                                            | 6006 | 6006 |  			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; | 
                                                                                                            
                                                            | 6007 |  | -			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; | 
                                                                                                            
                                                            | 6008 |  | -			$formconfirm .= '</td></tr>' . "\n"; | 
                                                                                                            
                                                            |  | 6007 | +			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title; | 
                                                                                                            
                                                            |  | 6008 | +			$formconfirm .= '</td></tr>'."\n"; | 
                                                                                                            
                                                            | 6009 | 6009 |   | 
                                                                                                            
                                                            | 6010 | 6010 |  			// Line text | 
                                                                                                            
                                                            | 6011 | 6011 |  			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                                                                            
                                                            | 6012 |  | -				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; | 
                                                                                                            
                                                            |  | 6012 | +				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; | 
                                                                                                            
                                                            | 6013 | 6013 |  			} | 
                                                                                                            
                                                            | 6014 | 6014 |   | 
                                                                                                            
                                                            | 6015 | 6015 |  			// Line form fields | 
                                                                                                            
                                                            | 6016 | 6016 |  			if ($more) { | 
                                                                                                            
                                                            | 6017 |  | -				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; | 
                                                                                                            
                                                            |  | 6017 | +				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; | 
                                                                                                            
                                                            | 6018 | 6018 |  				$formconfirm .= $more; | 
                                                                                                            
                                                            | 6019 |  | -				$formconfirm .= '</td></tr>' . "\n"; | 
                                                                                                            
                                                            |  | 6019 | +				$formconfirm .= '</td></tr>'."\n"; | 
                                                                                                            
                                                            | 6020 | 6020 |  			} | 
                                                                                                            
                                                            | 6021 | 6021 |   | 
                                                                                                            
                                                            | 6022 | 6022 |  			// Line with question | 
                                                                                                            
                                                            | 6023 | 6023 |  			$formconfirm .= '<tr class="valid">'; | 
                                                                                                            
                                                            | 6024 |  | -			$formconfirm .= '<td class="valid">' . $question . '</td>'; | 
                                                                                                            
                                                            |  | 6024 | +			$formconfirm .= '<td class="valid">'.$question.'</td>'; | 
                                                                                                            
                                                            | 6025 | 6025 |  			$formconfirm .= '<td class="valid center">'; | 
                                                                                                            
                                                            | 6026 | 6026 |  			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); | 
                                                                                                            
                                                            | 6027 |  | -			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; | 
                                                                                                            
                                                            |  | 6027 | +			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; | 
                                                                                                            
                                                            | 6028 | 6028 |  			$formconfirm .= '</td>'; | 
                                                                                                            
                                                            | 6029 |  | -			$formconfirm .= '</tr>' . "\n"; | 
                                                                                                            
                                                            |  | 6029 | +			$formconfirm .= '</tr>'."\n"; | 
                                                                                                            
                                                            | 6030 | 6030 |   | 
                                                                                                            
                                                            | 6031 |  | -			$formconfirm .= '</table>' . "\n"; | 
                                                                                                            
                                                            |  | 6031 | +			$formconfirm .= '</table>'."\n"; | 
                                                                                                            
                                                            | 6032 | 6032 |   | 
                                                                                                            
                                                            | 6033 | 6033 |  			if (empty($disableformtag)) { | 
                                                                                                            
                                                            | 6034 | 6034 |  				$formconfirm .= "</form>\n"; | 
                                                                                                                                                        
                                                        |  | @@ -6037,7 +6037,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6037 | 6037 |   | 
                                                                                                            
                                                            | 6038 | 6038 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 6039 | 6039 |  				$formconfirm .= '<!-- code to disable button to avoid double clic -->'; | 
                                                                                                            
                                                            | 6040 |  | -				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; | 
                                                                                                            
                                                            |  | 6040 | +				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; | 
                                                                                                            
                                                            | 6041 | 6041 |  				$formconfirm .= ' | 
                                                                                                            
                                                            | 6042 | 6042 |  				$(document).ready(function () { | 
                                                                                                            
                                                            | 6043 | 6043 |  					$(".confirmvalidatebutton").on("click", function() { | 
                                                                                                                                                        
                                                        |  | @@ -6049,7 +6049,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6049 | 6049 |  					}); | 
                                                                                                            
                                                            | 6050 | 6050 |  				}); | 
                                                                                                            
                                                            | 6051 | 6051 |  				'; | 
                                                                                                            
                                                            | 6052 |  | -				$formconfirm .= '</script>' . "\n"; | 
                                                                                                            
                                                            |  | 6052 | +				$formconfirm .= '</script>'."\n"; | 
                                                                                                            
                                                            | 6053 | 6053 |  			} | 
                                                                                                            
                                                            | 6054 | 6054 |   | 
                                                                                                            
                                                            | 6055 | 6055 |  			$formconfirm .= "<!-- end formconfirm -->\n"; | 
                                                                                                                                                        
                                                        |  | @@ -6081,8 +6081,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6081 | 6081 |  		// phpcs:enable | 
                                                                                                            
                                                            | 6082 | 6082 |  		global $langs; | 
                                                                                                            
                                                            | 6083 | 6083 |   | 
                                                                                                            
                                                            | 6084 |  | -		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; | 
                                                                                                            
                                                            | 6085 |  | -		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; | 
                                                                                                            
                                                            |  | 6084 | +		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; | 
                                                                                                            
                                                            |  | 6085 | +		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; | 
                                                                                                            
                                                            | 6086 | 6086 |   | 
                                                                                                            
                                                            | 6087 | 6087 |  		$out = ''; | 
                                                                                                            
                                                            | 6088 | 6088 |   | 
                                                                                                                                                        
                                                        |  | @@ -6090,11 +6090,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6090 | 6090 |   | 
                                                                                                            
                                                            | 6091 | 6091 |  		$langs->load("project"); | 
                                                                                                            
                                                            | 6092 | 6092 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6093 |  | -			$out .= '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6093 | +			$out .= '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6094 | 6094 |  			$out .= '<input type="hidden" name="action" value="classin">'; | 
                                                                                                            
                                                            | 6095 |  | -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6095 | +			$out .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6096 | 6096 |  			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); | 
                                                                                                            
                                                            | 6097 |  | -			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6097 | +			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6098 | 6098 |  			$out .= '</form>'; | 
                                                                                                            
                                                            | 6099 | 6099 |  		} else { | 
                                                                                                            
                                                            | 6100 | 6100 |  			$out .= '<span class="project_head_block">'; | 
                                                                                                                                                        
                                                        |  | @@ -6103,7 +6103,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6103 | 6103 |  				$projet->fetch($selected); | 
                                                                                                            
                                                            | 6104 | 6104 |  				$out .= $projet->getNomUrl(0, '', 1); | 
                                                                                                            
                                                            | 6105 | 6105 |  			} else { | 
                                                                                                            
                                                            | 6106 |  | -				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; | 
                                                                                                            
                                                            |  | 6106 | +				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; | 
                                                                                                            
                                                            | 6107 | 6107 |  			} | 
                                                                                                            
                                                            | 6108 | 6108 |  			$out .= '</span>'; | 
                                                                                                            
                                                            | 6109 | 6109 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -6140,14 +6140,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6140 | 6140 |  		$out = ''; | 
                                                                                                            
                                                            | 6141 | 6141 |   | 
                                                                                                            
                                                            | 6142 | 6142 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6143 |  | -			$out .= '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6143 | +			$out .= '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6144 | 6144 |  			$out .= '<input type="hidden" name="action" value="setconditions">'; | 
                                                                                                            
                                                            | 6145 |  | -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6145 | +			$out .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6146 | 6146 |  			if ($type) { | 
                                                                                                            
                                                            | 6147 |  | -				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; | 
                                                                                                            
                                                            |  | 6147 | +				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; | 
                                                                                                            
                                                            | 6148 | 6148 |  			} | 
                                                                                                            
                                                            | 6149 | 6149 |  			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); | 
                                                                                                            
                                                            | 6150 |  | -			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6150 | +			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6151 | 6151 |  			$out .= '</form>'; | 
                                                                                                            
                                                            | 6152 | 6152 |  		} else { | 
                                                                                                            
                                                            | 6153 | 6153 |  			if ($selected) { | 
                                                                                                                                                        
                                                        |  | @@ -6192,12 +6192,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6192 | 6192 |  		// phpcs:enable | 
                                                                                                            
                                                            | 6193 | 6193 |  		global $langs; | 
                                                                                                            
                                                            | 6194 | 6194 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6195 |  | -			print '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6195 | +			print '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6196 | 6196 |  			print '<input type="hidden" name="action" value="setavailability">'; | 
                                                                                                            
                                                            | 6197 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6197 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6198 | 6198 |  			$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty); | 
                                                                                                            
                                                            | 6199 |  | -			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            | 6200 |  | -			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; | 
                                                                                                            
                                                            |  | 6199 | +			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            |  | 6200 | +			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; | 
                                                                                                            
                                                            | 6201 | 6201 |  			print '</form>'; | 
                                                                                                            
                                                            | 6202 | 6202 |  		} else { | 
                                                                                                            
                                                            | 6203 | 6203 |  			if ($selected) { | 
                                                                                                                                                        
                                                        |  | @@ -6223,11 +6223,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6223 | 6223 |  	{ | 
                                                                                                            
                                                            | 6224 | 6224 |  		global $langs; | 
                                                                                                            
                                                            | 6225 | 6225 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6226 |  | -			print '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6226 | +			print '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6227 | 6227 |  			print '<input type="hidden" name="action" value="setdemandreason">'; | 
                                                                                                            
                                                            | 6228 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6228 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6229 | 6229 |  			$this->selectInputReason($selected, $htmlname, '-1', $addempty); | 
                                                                                                            
                                                            | 6230 |  | -			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6230 | +			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6231 | 6231 |  			print '</form>'; | 
                                                                                                            
                                                            | 6232 | 6232 |  		} else { | 
                                                                                                            
                                                            | 6233 | 6233 |  			if ($selected) { | 
                                                                                                                                                        
                                                        |  | @@ -6267,17 +6267,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6267 | 6267 |  		$ret = ''; | 
                                                                                                            
                                                            | 6268 | 6268 |   | 
                                                                                                            
                                                            | 6269 | 6269 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6270 |  | -			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; | 
                                                                                                            
                                                            | 6271 |  | -			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; | 
                                                                                                            
                                                            | 6272 |  | -			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6270 | +			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; | 
                                                                                                            
                                                            |  | 6271 | +			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; | 
                                                                                                            
                                                            |  | 6272 | +			$ret .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6273 | 6273 |  			if ($type) { | 
                                                                                                            
                                                            | 6274 |  | -				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; | 
                                                                                                            
                                                            |  | 6274 | +				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; | 
                                                                                                            
                                                            | 6275 | 6275 |  			} | 
                                                                                                            
                                                            | 6276 | 6276 |  			$ret .= '<table class="nobordernopadding">'; | 
                                                                                                            
                                                            | 6277 | 6277 |  			$ret .= '<tr><td>'; | 
                                                                                                            
                                                            | 6278 |  | -			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); | 
                                                                                                            
                                                            |  | 6278 | +			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); | 
                                                                                                            
                                                            | 6279 | 6279 |  			$ret .= '</td>'; | 
                                                                                                            
                                                            | 6280 |  | -			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                                                                            
                                                            |  | 6280 | +			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                                                                            
                                                            | 6281 | 6281 |  			$ret .= '</tr></table></form>'; | 
                                                                                                            
                                                            | 6282 | 6282 |  		} else { | 
                                                                                                            
                                                            | 6283 | 6283 |  			if ($displayhour) { | 
                                                                                                                                                        
                                                        |  | @@ -6312,15 +6312,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6312 | 6312 |  		global $langs; | 
                                                                                                            
                                                            | 6313 | 6313 |   | 
                                                                                                            
                                                            | 6314 | 6314 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6315 |  | -			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; | 
                                                                                                            
                                                            | 6316 |  | -			print '<input type="hidden" name="action" value="set' . $htmlname . '">'; | 
                                                                                                            
                                                            | 6317 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6315 | +			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; | 
                                                                                                            
                                                            |  | 6316 | +			print '<input type="hidden" name="action" value="set'.$htmlname.'">'; | 
                                                                                                            
                                                            |  | 6317 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6318 | 6318 |  			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); | 
                                                                                                            
                                                            | 6319 |  | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6319 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6320 | 6320 |  			print '</form>'; | 
                                                                                                            
                                                            | 6321 | 6321 |  		} else { | 
                                                                                                            
                                                            | 6322 | 6322 |  			if ($selected) { | 
                                                                                                            
                                                            | 6323 |  | -				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; | 
                                                                                                            
                                                            |  | 6323 | +				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; | 
                                                                                                            
                                                            | 6324 | 6324 |  				$theuser = new User($this->db); | 
                                                                                                            
                                                            | 6325 | 6325 |  				$theuser->fetch($selected); | 
                                                                                                            
                                                            | 6326 | 6326 |  				print $theuser->getNomUrl(1); | 
                                                                                                                                                        
                                                        |  | @@ -6353,14 +6353,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6353 | 6353 |   | 
                                                                                                            
                                                            | 6354 | 6354 |  		$out = ''; | 
                                                                                                            
                                                            | 6355 | 6355 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6356 |  | -			$out .= '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6356 | +			$out .= '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6357 | 6357 |  			$out .= '<input type="hidden" name="action" value="setmode">'; | 
                                                                                                            
                                                            | 6358 |  | -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6358 | +			$out .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6359 | 6359 |  			if ($type) { | 
                                                                                                            
                                                            | 6360 |  | -				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; | 
                                                                                                            
                                                            |  | 6360 | +				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; | 
                                                                                                            
                                                            | 6361 | 6361 |  			} | 
                                                                                                            
                                                            | 6362 | 6362 |  			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); | 
                                                                                                            
                                                            | 6363 |  | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6363 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6364 | 6364 |  			$out .= '</form>'; | 
                                                                                                            
                                                            | 6365 | 6365 |  		} else { | 
                                                                                                            
                                                            | 6366 | 6366 |  			if ($selected) { | 
                                                                                                                                                        
                                                        |  | @@ -6393,11 +6393,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6393 | 6393 |  	{ | 
                                                                                                            
                                                            | 6394 | 6394 |  		global $langs; | 
                                                                                                            
                                                            | 6395 | 6395 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6396 |  | -			print '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6396 | +			print '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6397 | 6397 |  			print '<input type="hidden" name="action" value="settransportmode">'; | 
                                                                                                            
                                                            | 6398 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6398 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6399 | 6399 |  			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); | 
                                                                                                            
                                                            | 6400 |  | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6400 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6401 | 6401 |  			print '</form>'; | 
                                                                                                            
                                                            | 6402 | 6402 |  		} else { | 
                                                                                                            
                                                            | 6403 | 6403 |  			if ($selected) { | 
                                                                                                                                                        
                                                        |  | @@ -6424,14 +6424,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6424 | 6424 |  		// phpcs:enable | 
                                                                                                            
                                                            | 6425 | 6425 |  		global $langs; | 
                                                                                                            
                                                            | 6426 | 6426 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6427 |  | -			print '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6427 | +			print '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6428 | 6428 |  			print '<input type="hidden" name="action" value="setmulticurrencycode">'; | 
                                                                                                            
                                                            | 6429 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6429 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6430 | 6430 |  			print $this->selectMultiCurrency($selected, $htmlname, 0); | 
                                                                                                            
                                                            | 6431 |  | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6431 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6432 | 6432 |  			print '</form>'; | 
                                                                                                            
                                                            | 6433 | 6433 |  		} else { | 
                                                                                                            
                                                            | 6434 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; | 
                                                                                                            
                                                            |  | 6434 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; | 
                                                                                                            
                                                            | 6435 | 6435 |  			print !empty($selected) ? currency_name($selected, 1) : ' '; | 
                                                                                                            
                                                            | 6436 | 6436 |  		} | 
                                                                                                            
                                                            | 6437 | 6437 |  	} | 
                                                                                                                                                        
                                                        |  | @@ -6453,22 +6453,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6453 | 6453 |  		global $langs, $mysoc, $conf; | 
                                                                                                            
                                                            | 6454 | 6454 |   | 
                                                                                                            
                                                            | 6455 | 6455 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6456 |  | -			print '<form method="POST" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6456 | +			print '<form method="POST" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6457 | 6457 |  			print '<input type="hidden" name="action" value="setmulticurrencyrate">'; | 
                                                                                                            
                                                            | 6458 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            | 6459 |  | -			print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; | 
                                                                                                            
                                                            |  | 6458 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            |  | 6459 | +			print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; | 
                                                                                                            
                                                            | 6460 | 6460 |  			print '<select name="calculation_mode" id="calculation_mode">'; | 
                                                                                                            
                                                            | 6461 |  | -			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; | 
                                                                                                            
                                                            | 6462 |  | -			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; | 
                                                                                                            
                                                            |  | 6461 | +			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; | 
                                                                                                            
                                                            |  | 6462 | +			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; | 
                                                                                                            
                                                            | 6463 | 6463 |  			print '</select> '; | 
                                                                                                            
                                                            | 6464 | 6464 |  			print ajax_combobox("calculation_mode"); | 
                                                                                                            
                                                            | 6465 |  | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6465 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6466 | 6466 |  			print '</form>'; | 
                                                                                                            
                                                            | 6467 | 6467 |  		} else { | 
                                                                                                            
                                                            | 6468 | 6468 |  			if (!empty($rate)) { | 
                                                                                                            
                                                            | 6469 | 6469 |  				print price($rate, 1, $langs, 0, 0); | 
                                                                                                            
                                                            | 6470 | 6470 |  				if ($currency && $rate != 1) { | 
                                                                                                            
                                                            | 6471 |  | -					print '   <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>'; | 
                                                                                                            
                                                            |  | 6471 | +					print '   <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>'; | 
                                                                                                            
                                                            | 6472 | 6472 |  				} | 
                                                                                                            
                                                            | 6473 | 6473 |  			} else { | 
                                                                                                            
                                                            | 6474 | 6474 |  				print 1; | 
                                                                                                                                                        
                                                        |  | @@ -6498,9 +6498,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6498 | 6498 |  		// phpcs:enable | 
                                                                                                            
                                                            | 6499 | 6499 |  		global $conf, $langs; | 
                                                                                                            
                                                            | 6500 | 6500 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6501 |  | -			print '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6501 | +			print '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6502 | 6502 |  			print '<input type="hidden" name="action" value="setabsolutediscount">'; | 
                                                                                                            
                                                            | 6503 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6503 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6504 | 6504 |  			print '<div class="inline-block">'; | 
                                                                                                            
                                                            | 6505 | 6505 |  			if (!empty($discount_type)) { | 
                                                                                                            
                                                            | 6506 | 6506 |  				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { | 
                                                                                                                                                        
                                                        |  | @@ -6538,24 +6538,24 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6538 | 6538 |  			print '</div>'; | 
                                                                                                            
                                                            | 6539 | 6539 |  			if (empty($hidelist)) { | 
                                                                                                            
                                                            | 6540 | 6540 |  				print '<div class="inline-block" style="padding-right: 10px">'; | 
                                                                                                            
                                                            | 6541 |  | -				$newfilter = 'discount_type=' . intval($discount_type); | 
                                                                                                            
                                                            |  | 6541 | +				$newfilter = 'discount_type='.intval($discount_type); | 
                                                                                                            
                                                            | 6542 | 6542 |  				if (!empty($discount_type)) { | 
                                                                                                            
                                                            | 6543 | 6543 |  					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available | 
                                                                                                            
                                                            | 6544 | 6544 |  				} else { | 
                                                                                                            
                                                            | 6545 | 6545 |  					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available | 
                                                                                                            
                                                            | 6546 | 6546 |  				} | 
                                                                                                            
                                                            | 6547 | 6547 |  				if ($filter) { | 
                                                                                                            
                                                            | 6548 |  | -					$newfilter .= ' AND (' . $filter . ')'; | 
                                                                                                            
                                                            |  | 6548 | +					$newfilter .= ' AND ('.$filter.')'; | 
                                                                                                            
                                                            | 6549 | 6549 |  				} | 
                                                                                                            
                                                            | 6550 | 6550 |  				// output the combo of discounts | 
                                                                                                            
                                                            | 6551 | 6551 |  				$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue); | 
                                                                                                            
                                                            | 6552 | 6552 |  				if ($nbqualifiedlines > 0) { | 
                                                                                                            
                                                            | 6553 |  | -					print '   <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; | 
                                                                                                            
                                                            |  | 6553 | +					print '   <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; | 
                                                                                                            
                                                            | 6554 | 6554 |  					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { | 
                                                                                                            
                                                            | 6555 |  | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                                                                            
                                                            |  | 6555 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                                                                            
                                                            | 6556 | 6556 |  					} | 
                                                                                                            
                                                            | 6557 | 6557 |  					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { | 
                                                                                                            
                                                            | 6558 |  | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                                                                            
                                                            |  | 6558 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                                                                            
                                                            | 6559 | 6559 |  					} | 
                                                                                                            
                                                            | 6560 | 6560 |   | 
                                                                                                            
                                                            | 6561 | 6561 |  					print '>'; | 
                                                                                                                                                        
                                                        |  | @@ -6595,23 +6595,23 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6595 | 6595 |  		global $langs; | 
                                                                                                            
                                                            | 6596 | 6596 |   | 
                                                                                                            
                                                            | 6597 | 6597 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6598 |  | -			print '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6598 | +			print '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6599 | 6599 |  			print '<input type="hidden" name="action" value="set_contact">'; | 
                                                                                                            
                                                            | 6600 |  | -			print '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6600 | +			print '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6601 | 6601 |  			print '<table class="nobordernopadding">'; | 
                                                                                                            
                                                            | 6602 | 6602 |  			print '<tr><td>'; | 
                                                                                                            
                                                            | 6603 | 6603 |  			print $this->selectcontacts($societe->id, $selected, $htmlname); | 
                                                                                                            
                                                            | 6604 | 6604 |  			$num = $this->num; | 
                                                                                                            
                                                            | 6605 | 6605 |  			if ($num == 0) { | 
                                                                                                            
                                                            | 6606 | 6606 |  				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); | 
                                                                                                            
                                                            | 6607 |  | -				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; | 
                                                                                                            
                                                            |  | 6607 | +				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; | 
                                                                                                            
                                                            | 6608 | 6608 |  			} | 
                                                                                                            
                                                            | 6609 | 6609 |  			print '</td>'; | 
                                                                                                            
                                                            | 6610 |  | -			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                                                                            
                                                            |  | 6610 | +			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                                                                            
                                                            | 6611 | 6611 |  			print '</tr></table></form>'; | 
                                                                                                            
                                                            | 6612 | 6612 |  		} else { | 
                                                                                                            
                                                            | 6613 | 6613 |  			if ($selected) { | 
                                                                                                            
                                                            | 6614 |  | -				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; | 
                                                                                                            
                                                            |  | 6614 | +				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; | 
                                                                                                            
                                                            | 6615 | 6615 |  				$contact = new Contact($this->db); | 
                                                                                                            
                                                            | 6616 | 6616 |  				$contact->fetch($selected); | 
                                                                                                            
                                                            | 6617 | 6617 |  				print $contact->getFullName($langs); | 
                                                                                                                                                        
                                                        |  | @@ -6646,20 +6646,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6646 | 6646 |   | 
                                                                                                            
                                                            | 6647 | 6647 |  		$out = ''; | 
                                                                                                            
                                                            | 6648 | 6648 |  		if ($htmlname != "none") { | 
                                                                                                            
                                                            | 6649 |  | -			$out .= '<form method="post" action="' . $page . '">'; | 
                                                                                                            
                                                            |  | 6649 | +			$out .= '<form method="post" action="'.$page.'">'; | 
                                                                                                            
                                                            | 6650 | 6650 |  			$out .= '<input type="hidden" name="action" value="set_thirdparty">'; | 
                                                                                                            
                                                            | 6651 |  | -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 6651 | +			$out .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 6652 | 6652 |  			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); | 
                                                                                                            
                                                            | 6653 |  | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                                                                            
                                                            |  | 6653 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                                                                            
                                                            | 6654 | 6654 |  			$out .= '</form>'; | 
                                                                                                            
                                                            | 6655 | 6655 |  		} else { | 
                                                                                                            
                                                            | 6656 | 6656 |  			if ($selected) { | 
                                                                                                            
                                                            | 6657 |  | -				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; | 
                                                                                                            
                                                            |  | 6657 | +				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; | 
                                                                                                            
                                                            | 6658 | 6658 |  				$soc = new Societe($this->db); | 
                                                                                                            
                                                            | 6659 | 6659 |  				$soc->fetch($selected); | 
                                                                                                            
                                                            | 6660 | 6660 |  				$out .= $soc->getNomUrl(0, ''); | 
                                                                                                            
                                                            | 6661 | 6661 |  			} else { | 
                                                                                                            
                                                            | 6662 |  | -				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; | 
                                                                                                            
                                                            |  | 6662 | +				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; | 
                                                                                                            
                                                            | 6663 | 6663 |  			} | 
                                                                                                            
                                                            | 6664 | 6664 |  		} | 
                                                                                                            
                                                            | 6665 | 6665 |   | 
                                                                                                                                                        
                                                        |  | @@ -6709,22 +6709,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6709 | 6709 |  			$selected = 'EUR'; // Pour compatibilite | 
                                                                                                            
                                                            | 6710 | 6710 |  		} | 
                                                                                                            
                                                            | 6711 | 6711 |   | 
                                                                                                            
                                                            | 6712 |  | -		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 6712 | +		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 6713 | 6713 |  		if ($useempty) { | 
                                                                                                            
                                                            | 6714 | 6714 |  			$out .= '<option value="-1" selected></option>'; | 
                                                                                                            
                                                            | 6715 | 6715 |  		} | 
                                                                                                            
                                                            | 6716 | 6716 |  		foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                                                                            
                                                            | 6717 | 6717 |  			$labeltoshow = $currency['label']; | 
                                                                                                            
                                                            | 6718 | 6718 |  			if ($mode == 1) { | 
                                                                                                            
                                                            | 6719 |  | -				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; | 
                                                                                                            
                                                            |  | 6719 | +				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; | 
                                                                                                            
                                                            | 6720 | 6720 |  			} else { | 
                                                                                                            
                                                            | 6721 |  | -				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; | 
                                                                                                            
                                                            |  | 6721 | +				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; | 
                                                                                                            
                                                            | 6722 | 6722 |  			} | 
                                                                                                            
                                                            | 6723 | 6723 |   | 
                                                                                                            
                                                            | 6724 | 6724 |  			if ($selected && $selected == $code_iso) { | 
                                                                                                            
                                                            | 6725 |  | -				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; | 
                                                                                                            
                                                            |  | 6725 | +				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; | 
                                                                                                            
                                                            | 6726 | 6726 |  			} else { | 
                                                                                                            
                                                            | 6727 |  | -				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; | 
                                                                                                            
                                                            |  | 6727 | +				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; | 
                                                                                                            
                                                            | 6728 | 6728 |  			} | 
                                                                                                            
                                                            | 6729 | 6729 |  			$out .= dol_string_nohtmltag($labeltoshow); | 
                                                                                                            
                                                            | 6730 | 6730 |  			$out .= '</option>'; | 
                                                                                                                                                        
                                                        |  | @@ -6735,7 +6735,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6735 | 6735 |  		} | 
                                                                                                            
                                                            | 6736 | 6736 |   | 
                                                                                                            
                                                            | 6737 | 6737 |  		// Make select dynamic | 
                                                                                                            
                                                            | 6738 |  | -		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 6738 | +		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 6739 | 6739 |  		$out .= ajax_combobox($htmlname); | 
                                                                                                            
                                                            | 6740 | 6740 |   | 
                                                                                                            
                                                            | 6741 | 6741 |  		return $out; | 
                                                                                                                                                        
                                                        |  | @@ -6761,10 +6761,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6761 | 6761 |   | 
                                                                                                            
                                                            | 6762 | 6762 |  		$TCurrency = array(); | 
                                                                                                            
                                                            | 6763 | 6763 |   | 
                                                                                                            
                                                            | 6764 |  | -		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; | 
                                                                                                            
                                                            | 6765 |  | -		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; | 
                                                                                                            
                                                            |  | 6764 | +		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; | 
                                                                                                            
                                                            |  | 6765 | +		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; | 
                                                                                                            
                                                            | 6766 | 6766 |  		if ($filter) { | 
                                                                                                            
                                                            | 6767 |  | -			$sql .= " AND " . $filter; | 
                                                                                                            
                                                            |  | 6767 | +			$sql .= " AND ".$filter; | 
                                                                                                            
                                                            | 6768 | 6768 |  		} | 
                                                                                                            
                                                            | 6769 | 6769 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 6770 | 6770 |  		if ($resql) { | 
                                                                                                                                                        
                                                        |  | @@ -6774,7 +6774,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6774 | 6774 |  		} | 
                                                                                                            
                                                            | 6775 | 6775 |   | 
                                                                                                            
                                                            | 6776 | 6776 |  		$out = ''; | 
                                                                                                            
                                                            | 6777 |  | -		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 6777 | +		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 6778 | 6778 |  		if ($useempty) { | 
                                                                                                            
                                                            | 6779 | 6779 |  			$out .= '<option value=""> </option>'; | 
                                                                                                            
                                                            | 6780 | 6780 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -6786,13 +6786,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6786 | 6786 |  			foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                                                                            
                                                            | 6787 | 6787 |  				if (isset($TCurrency[$code_iso])) { | 
                                                                                                            
                                                            | 6788 | 6788 |  					if (!empty($selected) && $selected == $code_iso) { | 
                                                                                                            
                                                            | 6789 |  | -						$out .= '<option value="' . $code_iso . '" selected="selected">'; | 
                                                                                                            
                                                            |  | 6789 | +						$out .= '<option value="'.$code_iso.'" selected="selected">'; | 
                                                                                                            
                                                            | 6790 | 6790 |  					} else { | 
                                                                                                            
                                                            | 6791 |  | -						$out .= '<option value="' . $code_iso . '">'; | 
                                                                                                            
                                                            |  | 6791 | +						$out .= '<option value="'.$code_iso.'">'; | 
                                                                                                            
                                                            | 6792 | 6792 |  					} | 
                                                                                                            
                                                            | 6793 | 6793 |   | 
                                                                                                            
                                                            | 6794 | 6794 |  					$out .= $currency['label']; | 
                                                                                                            
                                                            | 6795 |  | -					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; | 
                                                                                                            
                                                            |  | 6795 | +					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; | 
                                                                                                            
                                                            | 6796 | 6796 |  					$out .= '</option>'; | 
                                                                                                            
                                                            | 6797 | 6797 |  				} | 
                                                                                                            
                                                            | 6798 | 6798 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -6801,7 +6801,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6801 | 6801 |  		$out .= '</select>'; | 
                                                                                                            
                                                            | 6802 | 6802 |   | 
                                                                                                            
                                                            | 6803 | 6803 |  		// Make select dynamic | 
                                                                                                            
                                                            | 6804 |  | -		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 6804 | +		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 6805 | 6805 |  		$out .= ajax_combobox($htmlname); | 
                                                                                                            
                                                            | 6806 | 6806 |   | 
                                                                                                            
                                                            | 6807 | 6807 |  		return $out; | 
                                                                                                                                                        
                                                        |  | @@ -6832,7 +6832,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6832 | 6832 |  		$sql .= " WHERE t.fk_pays = c.rowid"; | 
                                                                                                            
                                                            | 6833 | 6833 |  		$sql .= " AND t.active > 0"; | 
                                                                                                            
                                                            | 6834 | 6834 |  		$sql .= " AND t.entity IN (".getEntity('c_tva').")"; | 
                                                                                                            
                                                            | 6835 |  | -		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; | 
                                                                                                            
                                                            |  | 6835 | +		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; | 
                                                                                                            
                                                            | 6836 | 6836 |  		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; | 
                                                                                                            
                                                            | 6837 | 6837 |   | 
                                                                                                            
                                                            | 6838 | 6838 |  		$resql = $this->db->query($sql); | 
                                                                                                                                                        
                                                        |  | @@ -6844,30 +6844,30 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6844 | 6844 |   | 
                                                                                                            
                                                            | 6845 | 6845 |  					$tmparray = array(); | 
                                                                                                            
                                                            | 6846 | 6846 |  					$tmparray['rowid']			= $obj->rowid; | 
                                                                                                            
                                                            | 6847 |  | -					$tmparray['type_vat']		= $obj->type_vat; | 
                                                                                                            
                                                            | 6848 |  | -					$tmparray['code']			= $obj->code; | 
                                                                                                            
                                                            |  | 6847 | +					$tmparray['type_vat'] = $obj->type_vat; | 
                                                                                                            
                                                            |  | 6848 | +					$tmparray['code'] = $obj->code; | 
                                                                                                            
                                                            | 6849 | 6849 |  					$tmparray['txtva']			= $obj->taux; | 
                                                                                                            
                                                            | 6850 |  | -					$tmparray['nprtva']			= $obj->recuperableonly; | 
                                                                                                            
                                                            |  | 6850 | +					$tmparray['nprtva'] = $obj->recuperableonly; | 
                                                                                                            
                                                            | 6851 | 6851 |  					$tmparray['localtax1']	    = $obj->localtax1; | 
                                                                                                            
                                                            | 6852 | 6852 |  					$tmparray['localtax1_type']	= $obj->localtax1_type; | 
                                                                                                            
                                                            | 6853 | 6853 |  					$tmparray['localtax2']	    = $obj->localtax2; | 
                                                                                                            
                                                            | 6854 | 6854 |  					$tmparray['localtax2_type']	= $obj->localtax1_type; | 
                                                                                                            
                                                            | 6855 |  | -					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * | 
                                                                                                            
                                                            | 6856 |  | -					$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 | 
                                                                                                            
                                                            |  | 6855 | +					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * | 
                                                                                                            
                                                            |  | 6856 | +					$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 | 
                                                                                                            
                                                            | 6857 | 6857 |  					$positiverates = ''; | 
                                                                                                            
                                                            | 6858 | 6858 |  					if ($obj->taux) { | 
                                                                                                            
                                                            | 6859 |  | -						$positiverates .= ($positiverates ? '/' : '') . $obj->taux; | 
                                                                                                            
                                                            |  | 6859 | +						$positiverates .= ($positiverates ? '/' : '').$obj->taux; | 
                                                                                                            
                                                            | 6860 | 6860 |  					} | 
                                                                                                            
                                                            | 6861 | 6861 |  					if ($obj->localtax1) { | 
                                                                                                            
                                                            | 6862 |  | -						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; | 
                                                                                                            
                                                            |  | 6862 | +						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1; | 
                                                                                                            
                                                            | 6863 | 6863 |  					} | 
                                                                                                            
                                                            | 6864 | 6864 |  					if ($obj->localtax2) { | 
                                                                                                            
                                                            | 6865 |  | -						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; | 
                                                                                                            
                                                            |  | 6865 | +						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2; | 
                                                                                                            
                                                            | 6866 | 6866 |  					} | 
                                                                                                            
                                                            | 6867 | 6867 |  					if (empty($positiverates)) { | 
                                                                                                            
                                                            | 6868 | 6868 |  						$positiverates = '0'; | 
                                                                                                            
                                                            | 6869 | 6869 |  					} | 
                                                                                                            
                                                            | 6870 |  | -					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label | 
                                                                                                            
                                                            |  | 6870 | +					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label | 
                                                                                                            
                                                            | 6871 | 6871 |   | 
                                                                                                            
                                                            | 6872 | 6872 |  					$this->cache_vatrates[$obj->rowid] = $tmparray; | 
                                                                                                            
                                                            | 6873 | 6873 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -6887,7 +6887,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6887 | 6887 |  				return -1; | 
                                                                                                            
                                                            | 6888 | 6888 |  			} | 
                                                                                                            
                                                            | 6889 | 6889 |  		} else { | 
                                                                                                            
                                                            | 6890 |  | -			$this->error = '<span class="error">' . $this->db->error() . '</span>'; | 
                                                                                                            
                                                            |  | 6890 | +			$this->error = '<span class="error">'.$this->db->error().'</span>'; | 
                                                                                                            
                                                            | 6891 | 6891 |  			return -2; | 
                                                                                                            
                                                            | 6892 | 6892 |  		} | 
                                                                                                            
                                                            | 6893 | 6893 |  	} | 
                                                                                                                                                        
                                                        |  | @@ -6959,9 +6959,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6959 | 6959 |  		// Check parameters | 
                                                                                                            
                                                            | 6960 | 6960 |  		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { | 
                                                                                                            
                                                            | 6961 | 6961 |  			if ($societe_vendeuse->id == $mysoc->id) { | 
                                                                                                            
                                                            | 6962 |  | -				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; | 
                                                                                                            
                                                            |  | 6962 | +				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; | 
                                                                                                            
                                                            | 6963 | 6963 |  			} else { | 
                                                                                                            
                                                            | 6964 |  | -				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; | 
                                                                                                            
                                                            |  | 6964 | +				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; | 
                                                                                                            
                                                            | 6965 | 6965 |  			} | 
                                                                                                            
                                                            | 6966 | 6966 |  			return $return; | 
                                                                                                            
                                                            | 6967 | 6967 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -6973,12 +6973,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6973 | 6973 |  		// Define list of countries to use to search VAT rates to show | 
                                                                                                            
                                                            | 6974 | 6974 |  		// First we defined code_country to use to find list | 
                                                                                                            
                                                            | 6975 | 6975 |  		if (is_object($societe_vendeuse)) { | 
                                                                                                            
                                                            | 6976 |  | -			$code_country = "'" . $societe_vendeuse->country_code . "'"; | 
                                                                                                            
                                                            |  | 6976 | +			$code_country = "'".$societe_vendeuse->country_code."'"; | 
                                                                                                            
                                                            | 6977 | 6977 |  		} else { | 
                                                                                                            
                                                            | 6978 |  | -			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente | 
                                                                                                            
                                                            |  | 6978 | +			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente | 
                                                                                                            
                                                            | 6979 | 6979 |  		} | 
                                                                                                            
                                                            | 6980 | 6980 |  		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on | 
                                                                                                            
                                                            | 6981 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; | 
                                                                                                            
                                                            |  | 6981 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; | 
                                                                                                            
                                                            | 6982 | 6982 |  			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries | 
                                                                                                            
                                                            | 6983 | 6983 |  			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country | 
                                                                                                            
                                                            | 6984 | 6984 |  			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); | 
                                                                                                                                                        
                                                        |  | @@ -6988,27 +6988,27 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 6988 | 6988 |  					if ($type == 1) { // We know product is a service | 
                                                                                                            
                                                            | 6989 | 6989 |  						switch ($selectVatComboMode) { | 
                                                                                                            
                                                            | 6990 | 6990 |  							case '1': | 
                                                                                                            
                                                            | 6991 |  | -								$code_country .= ",'" . $societe_acheteuse->country_code . "'"; | 
                                                                                                            
                                                            |  | 6991 | +								$code_country .= ",'".$societe_acheteuse->country_code."'"; | 
                                                                                                            
                                                            | 6992 | 6992 |  								break; | 
                                                                                                            
                                                            | 6993 | 6993 |  							case '2': | 
                                                                                                            
                                                            | 6994 |  | -								$code_country = "'" . $societe_acheteuse->country_code . "'"; | 
                                                                                                            
                                                            |  | 6994 | +								$code_country = "'".$societe_acheteuse->country_code."'"; | 
                                                                                                            
                                                            | 6995 | 6995 |  								break; | 
                                                                                                            
                                                            | 6996 | 6996 |  						} | 
                                                                                                            
                                                            | 6997 | 6997 |  					} | 
                                                                                                            
                                                            | 6998 | 6998 |  				} elseif (!$idprod) {  // We don't know type of product | 
                                                                                                            
                                                            | 6999 | 6999 |  					switch ($selectVatComboMode) { | 
                                                                                                            
                                                            | 7000 | 7000 |  						case '1': | 
                                                                                                            
                                                            | 7001 |  | -							$code_country .= ",'" . $societe_acheteuse->country_code . "'"; | 
                                                                                                            
                                                            |  | 7001 | +							$code_country .= ",'".$societe_acheteuse->country_code."'"; | 
                                                                                                            
                                                            | 7002 | 7002 |  							break; | 
                                                                                                            
                                                            | 7003 | 7003 |  						case '2': | 
                                                                                                            
                                                            | 7004 |  | -							$code_country = "'" . $societe_acheteuse->country_code . "'"; | 
                                                                                                            
                                                            |  | 7004 | +							$code_country = "'".$societe_acheteuse->country_code."'"; | 
                                                                                                            
                                                            | 7005 | 7005 |  							break; | 
                                                                                                            
                                                            | 7006 | 7006 |  					} | 
                                                                                                            
                                                            | 7007 | 7007 |  				} else { | 
                                                                                                            
                                                            | 7008 | 7008 |  					$prodstatic = new Product($this->db); | 
                                                                                                            
                                                            | 7009 | 7009 |  					$prodstatic->fetch($idprod); | 
                                                                                                            
                                                            | 7010 | 7010 |  					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service | 
                                                                                                            
                                                            | 7011 |  | -						$code_country .= ",'" . $societe_acheteuse->country_code . "'"; | 
                                                                                                            
                                                            |  | 7011 | +						$code_country .= ",'".$societe_acheteuse->country_code."'"; | 
                                                                                                            
                                                            | 7012 | 7012 |  					} | 
                                                                                                            
                                                            | 7013 | 7013 |  				} | 
                                                                                                            
                                                            | 7014 | 7014 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -7070,13 +7070,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7070 | 7070 |  				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead | 
                                                                                                            
                                                            | 7071 | 7071 |  				// of using supplier invoices (this is a very bad idea !) | 
                                                                                                            
                                                            | 7072 | 7072 |  				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { | 
                                                                                                            
                                                            | 7073 |  | -					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; | 
                                                                                                            
                                                            |  | 7073 | +					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; | 
                                                                                                            
                                                            | 7074 | 7074 |  					$disabled = true; | 
                                                                                                            
                                                            | 7075 | 7075 |  				} | 
                                                                                                            
                                                            | 7076 | 7076 |  			} | 
                                                                                                            
                                                            | 7077 | 7077 |   | 
                                                                                                            
                                                            | 7078 | 7078 |  			if (!$options_only) { | 
                                                                                                            
                                                            | 7079 |  | -				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; | 
                                                                                                            
                                                            |  | 7079 | +				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; | 
                                                                                                            
                                                            | 7080 | 7080 |  			} | 
                                                                                                            
                                                            | 7081 | 7081 |   | 
                                                                                                            
                                                            | 7082 | 7082 |  			$selectedfound = false; | 
                                                                                                                                                        
                                                        |  | @@ -7090,13 +7090,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7090 | 7090 |  				$key = $rate['txtva']; | 
                                                                                                            
                                                            | 7091 | 7091 |  				$key .= $rate['nprtva'] ? '*' : ''; | 
                                                                                                            
                                                            | 7092 | 7092 |  				if ($mode > 0 && $rate['code']) { | 
                                                                                                            
                                                            | 7093 |  | -					$key .= ' (' . $rate['code'] . ')'; | 
                                                                                                            
                                                            |  | 7093 | +					$key .= ' ('.$rate['code'].')'; | 
                                                                                                            
                                                            | 7094 | 7094 |  				} | 
                                                                                                            
                                                            | 7095 | 7095 |  				if ($mode < 0) { | 
                                                                                                            
                                                            | 7096 | 7096 |  					$key = $rate['rowid']; | 
                                                                                                            
                                                            | 7097 | 7097 |  				} | 
                                                                                                            
                                                            | 7098 | 7098 |   | 
                                                                                                            
                                                            | 7099 |  | -				$return .= '<option value="' . $key . '"'; | 
                                                                                                            
                                                            |  | 7099 | +				$return .= '<option value="'.$key.'"'; | 
                                                                                                            
                                                            | 7100 | 7100 |  				if (!$selectedfound) { | 
                                                                                                            
                                                            | 7101 | 7101 |  					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag | 
                                                                                                            
                                                            | 7102 | 7102 |  						if ($defaultcode == $rate['code']) { | 
                                                                                                                                                        
                                                        |  | @@ -7167,7 +7167,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7167 | 7167 |  	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 = '') | 
                                                                                                            
                                                            | 7168 | 7168 |  	{ | 
                                                                                                            
                                                            | 7169 | 7169 |  		// phpcs:enable | 
                                                                                                            
                                                            | 7170 |  | -		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); | 
                                                                                                            
                                                            |  | 7170 | +		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); | 
                                                                                                            
                                                            | 7171 | 7171 |  		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); | 
                                                                                                            
                                                            | 7172 | 7172 |  		if (!empty($nooutput)) { | 
                                                                                                            
                                                            | 7173 | 7173 |  			return $retstring; | 
                                                                                                                                                        
                                                        |  | @@ -7196,11 +7196,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7196 | 7196 |  	{ | 
                                                                                                            
                                                            | 7197 | 7197 |  		global $langs; | 
                                                                                                            
                                                            | 7198 | 7198 |   | 
                                                                                                            
                                                            | 7199 |  | -		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                                                                            
                                                            |  | 7199 | +		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                                                                            
                                                            | 7200 | 7200 |  		if ($forcenewline) { | 
                                                                                                            
                                                            | 7201 | 7201 |  			$ret .= '<br>'; | 
                                                                                                            
                                                            | 7202 | 7202 |  		} | 
                                                                                                            
                                                            | 7203 |  | -		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                                                                            
                                                            |  | 7203 | +		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                                                                            
                                                            | 7204 | 7204 |  		return $ret; | 
                                                                                                            
                                                            | 7205 | 7205 |  	} | 
                                                                                                            
                                                            | 7206 | 7206 |   | 
                                                                                                                                                        
                                                        |  | @@ -7267,7 +7267,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7267 | 7267 |  		$orig_set_time = $set_time; | 
                                                                                                            
                                                            | 7268 | 7268 |   | 
                                                                                                            
                                                            | 7269 | 7269 |  		if ($set_time === '' && $emptydate == 0) { | 
                                                                                                            
                                                            | 7270 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; | 
                                                                                                            
                                                            |  | 7270 | +			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; | 
                                                                                                            
                                                            | 7271 | 7271 |  			if ($gm == 'tzuser' || $gm == 'tzuserrel') { | 
                                                                                                            
                                                            | 7272 | 7272 |  				$set_time = dol_now($gm); | 
                                                                                                            
                                                            | 7273 | 7273 |  			} else { | 
                                                                                                                                                        
                                                        |  | @@ -7339,38 +7339,38 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7339 | 7339 |  				// Calendrier popup version eldy | 
                                                                                                            
                                                            | 7340 | 7340 |  				if ($usecalendar == "eldy") { | 
                                                                                                            
                                                            | 7341 | 7341 |  					// Input area to enter date manually | 
                                                                                                            
                                                            | 7342 |  | -					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formatted_date . '"'; | 
                                                                                                            
                                                            |  | 7342 | +					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formatted_date.'"'; | 
                                                                                                            
                                                            | 7343 | 7343 |  					$retstring .= ($disabled ? ' disabled' : ''); | 
                                                                                                            
                                                            | 7344 |  | -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                                                                            
                                                            |  | 7344 | +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                                                                            
                                                            | 7345 | 7345 |  					$retstring .= ' autocomplete="off">'; | 
                                                                                                            
                                                            | 7346 | 7346 |   | 
                                                                                                            
                                                            | 7347 | 7347 |  					// Icon calendar | 
                                                                                                            
                                                            | 7348 | 7348 |  					$retstringbuttom = ''; | 
                                                                                                            
                                                            | 7349 | 7349 |  					if (!$disabled) { | 
                                                                                                            
                                                            | 7350 |  | -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; | 
                                                                                                            
                                                            | 7351 |  | -						$base = DOL_URL_ROOT . '/core/'; | 
                                                                                                            
                                                            | 7352 |  | -						$retstringbuttom .= ' onClick="showDP(\'' . dol_escape_js($base) . '\',\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\',\'' . dol_escape_js($langs->defaultlang) . '\');"'; | 
                                                                                                            
                                                            | 7353 |  | -						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                                                                            
                                                            |  | 7350 | +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; | 
                                                                                                            
                                                            |  | 7351 | +						$base = DOL_URL_ROOT.'/core/'; | 
                                                                                                            
                                                            |  | 7352 | +						$retstringbuttom .= ' onClick="showDP(\''.dol_escape_js($base).'\',\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\',\''.dol_escape_js($langs->defaultlang).'\');"'; | 
                                                                                                            
                                                            |  | 7353 | +						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                                                                            
                                                            | 7354 | 7354 |  					} else { | 
                                                                                                            
                                                            | 7355 |  | -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                                                                            
                                                            |  | 7355 | +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                                                                            
                                                            | 7356 | 7356 |  					} | 
                                                                                                            
                                                            | 7357 |  | -					$retstring = $retstringbuttom . $retstring; | 
                                                                                                            
                                                            |  | 7357 | +					$retstring = $retstringbuttom.$retstring; | 
                                                                                                            
                                                            | 7358 | 7358 |   | 
                                                                                                            
                                                            | 7359 |  | -					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n"; | 
                                                                                                            
                                                            | 7360 |  | -					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; | 
                                                                                                            
                                                            | 7361 |  | -					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n"; | 
                                                                                                            
                                                            |  | 7359 | +					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n"; | 
                                                                                                            
                                                            |  | 7360 | +					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; | 
                                                                                                            
                                                            |  | 7361 | +					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n"; | 
                                                                                                            
                                                            | 7362 | 7362 |  				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { | 
                                                                                                            
                                                            | 7363 | 7363 |  					if (!$disabled && $usecalendar != 'html') { | 
                                                                                                            
                                                            | 7364 | 7364 |  						// Output javascript for datepicker | 
                                                                                                            
                                                            | 7365 | 7365 |  						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); | 
                                                                                                            
                                                            | 7366 | 7366 |  						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); | 
                                                                                                            
                                                            | 7367 | 7367 |   | 
                                                                                                            
                                                            | 7368 |  | -						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; | 
                                                                                                            
                                                            | 7369 |  | -						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ | 
                                                                                                            
                                                            | 7370 |  | -							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', | 
                                                                                                            
                                                            |  | 7368 | +						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; | 
                                                                                                            
                                                            |  | 7369 | +						$retstring .= "$(function(){ $('#".$prefix."').datepicker({ | 
                                                                                                            
                                                            |  | 7370 | +							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', | 
                                                                                                            
                                                            | 7371 | 7371 |  							autoclose: true, | 
                                                                                                            
                                                            | 7372 | 7372 |  							todayHighlight: true, | 
                                                                                                            
                                                            | 7373 |  | -							yearRange: '" . $minYear . ":" . $maxYear . "',"; | 
                                                                                                            
                                                            |  | 7373 | +							yearRange: '" . $minYear.":".$maxYear."',"; | 
                                                                                                            
                                                            | 7374 | 7374 |  						if (!empty($conf->dol_use_jmobile)) { | 
                                                                                                            
                                                            | 7375 | 7375 |  							$retstring .= " | 
                                                                                                            
                                                            | 7376 | 7376 |  								beforeShow: function (input, datePicker) { | 
                                                                                                                                                        
                                                        |  | @@ -7383,10 +7383,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7383 | 7383 |  						} | 
                                                                                                            
                                                            | 7384 | 7384 |  						// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php | 
                                                                                                            
                                                            | 7385 | 7385 |  						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { | 
                                                                                                            
                                                            | 7386 |  | -							$buttonImage = $calendarpicto ?: DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png"; | 
                                                                                                            
                                                            |  | 7386 | +							$buttonImage = $calendarpicto ?: DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png"; | 
                                                                                                            
                                                            | 7387 | 7387 |  							$retstring .= " | 
                                                                                                            
                                                            | 7388 | 7388 |  								showOn: 'button',	/* both has problem with autocompletion */ | 
                                                                                                            
                                                            | 7389 |  | -								buttonImage: '" . $buttonImage . "', | 
                                                                                                            
                                                            |  | 7389 | +								buttonImage: '" . $buttonImage."', | 
                                                                                                            
                                                            | 7390 | 7390 |  								buttonImageOnly: true"; | 
                                                                                                            
                                                            | 7391 | 7391 |  						} | 
                                                                                                            
                                                            | 7392 | 7392 |  						$retstring .= " | 
                                                                                                                                                        
                                                        |  | @@ -7398,46 +7398,46 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7398 | 7398 |  					$retstring .= '<div class="nowraponall inline-block divfordateinput">'; | 
                                                                                                            
                                                            | 7399 | 7399 |  					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="'.($usecalendar == 'html' ? "date" : "text").'" class="maxwidthdate center" maxlength="11" value="'.$formatted_date.'"'; | 
                                                                                                            
                                                            | 7400 | 7400 |  					$retstring .= ($disabled ? ' disabled' : ''); | 
                                                                                                            
                                                            | 7401 |  | -					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); | 
                                                                                                            
                                                            | 7402 |  | -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                                                                            
                                                            |  | 7401 | +					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); | 
                                                                                                            
                                                            |  | 7402 | +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                                                                            
                                                            | 7403 | 7403 |  					$retstring .= ' autocomplete="off">'; | 
                                                                                                            
                                                            | 7404 | 7404 |   | 
                                                                                                            
                                                            | 7405 | 7405 |  					// Icone calendrier | 
                                                                                                            
                                                            | 7406 | 7406 |  					if ($disabled) { | 
                                                                                                            
                                                            | 7407 |  | -						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                                                                            
                                                            | 7408 |  | -						$retstring = $retstringbutton . $retstring; | 
                                                                                                            
                                                            |  | 7407 | +						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                                                                            
                                                            |  | 7408 | +						$retstring = $retstringbutton.$retstring; | 
                                                                                                            
                                                            | 7409 | 7409 |  					} | 
                                                                                                            
                                                            | 7410 | 7410 |   | 
                                                                                                            
                                                            | 7411 | 7411 |  					$retstring .= '</div>'; | 
                                                                                                            
                                                            | 7412 |  | -					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n"; | 
                                                                                                            
                                                            | 7413 |  | -					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; | 
                                                                                                            
                                                            | 7414 |  | -					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n"; | 
                                                                                                            
                                                            |  | 7412 | +					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n"; | 
                                                                                                            
                                                            |  | 7413 | +					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; | 
                                                                                                            
                                                            |  | 7414 | +					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n"; | 
                                                                                                            
                                                            | 7415 | 7415 |  				} else { | 
                                                                                                            
                                                            | 7416 | 7416 |  					$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; | 
                                                                                                            
                                                            | 7417 | 7417 |  				} | 
                                                                                                            
                                                            | 7418 | 7418 |  			} else { | 
                                                                                                            
                                                            | 7419 | 7419 |  				// Show date with combo selects | 
                                                                                                            
                                                            | 7420 | 7420 |  				// Day | 
                                                                                                            
                                                            | 7421 |  | -				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; | 
                                                                                                            
                                                            |  | 7421 | +				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; | 
                                                                                                            
                                                            | 7422 | 7422 |   | 
                                                                                                            
                                                            | 7423 | 7423 |  				if ($emptydate || $set_time == -1) { | 
                                                                                                            
                                                            | 7424 | 7424 |  					$retstring .= '<option value="0" selected> </option>'; | 
                                                                                                            
                                                            | 7425 | 7425 |  				} | 
                                                                                                            
                                                            | 7426 | 7426 |   | 
                                                                                                            
                                                            | 7427 | 7427 |  				for ($day = 1; $day <= 31; $day++) { | 
                                                                                                            
                                                            | 7428 |  | -					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; | 
                                                                                                            
                                                            |  | 7428 | +					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; | 
                                                                                                            
                                                            | 7429 | 7429 |  				} | 
                                                                                                            
                                                            | 7430 | 7430 |   | 
                                                                                                            
                                                            | 7431 | 7431 |  				$retstring .= "</select>"; | 
                                                                                                            
                                                            | 7432 | 7432 |   | 
                                                                                                            
                                                            | 7433 |  | -				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; | 
                                                                                                            
                                                            |  | 7433 | +				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; | 
                                                                                                            
                                                            | 7434 | 7434 |  				if ($emptydate || $set_time == -1) { | 
                                                                                                            
                                                            | 7435 | 7435 |  					$retstring .= '<option value="0" selected> </option>'; | 
                                                                                                            
                                                            | 7436 | 7436 |  				} | 
                                                                                                            
                                                            | 7437 | 7437 |   | 
                                                                                                            
                                                            | 7438 | 7438 |  				// Month | 
                                                                                                            
                                                            | 7439 | 7439 |  				for ($month = 1; $month <= 12; $month++) { | 
                                                                                                            
                                                            | 7440 |  | -					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; | 
                                                                                                            
                                                            |  | 7440 | +					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; | 
                                                                                                            
                                                            | 7441 | 7441 |  					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); | 
                                                                                                            
                                                            | 7442 | 7442 |  					$retstring .= "</option>"; | 
                                                                                                            
                                                            | 7443 | 7443 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -7445,13 +7445,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7445 | 7445 |   | 
                                                                                                            
                                                            | 7446 | 7446 |  				// Year | 
                                                                                                            
                                                            | 7447 | 7447 |  				if ($emptydate || $set_time == -1) { | 
                                                                                                            
                                                            | 7448 |  | -					$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 . '">'; | 
                                                                                                            
                                                            |  | 7448 | +					$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.'">'; | 
                                                                                                            
                                                            | 7449 | 7449 |  				} else { | 
                                                                                                            
                                                            | 7450 |  | -					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; | 
                                                                                                            
                                                            |  | 7450 | +					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; | 
                                                                                                            
                                                            | 7451 | 7451 |   | 
                                                                                                            
                                                            | 7452 | 7452 |  					$syear = (int) $syear; | 
                                                                                                            
                                                            | 7453 | 7453 |  					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { | 
                                                                                                            
                                                            | 7454 |  | -						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; | 
                                                                                                            
                                                            |  | 7454 | +						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; | 
                                                                                                            
                                                            | 7455 | 7455 |  					} | 
                                                                                                            
                                                            | 7456 | 7456 |  					$retstring .= "</select>\n"; | 
                                                                                                            
                                                            | 7457 | 7457 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -7476,15 +7476,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7476 | 7476 |  			} | 
                                                                                                            
                                                            | 7477 | 7477 |   | 
                                                                                                            
                                                            | 7478 | 7478 |  			// Show hour | 
                                                                                                            
                                                            | 7479 |  | -			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; | 
                                                                                                            
                                                            |  | 7479 | +			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; | 
                                                                                                            
                                                            | 7480 | 7480 |  			if ($emptyhours) { | 
                                                                                                            
                                                            | 7481 | 7481 |  				$retstring .= '<option value="-1"> </option>'; | 
                                                                                                            
                                                            | 7482 | 7482 |  			} | 
                                                                                                            
                                                            | 7483 | 7483 |  			for ($hour = $hourstart; $hour < $hourend; $hour++) { | 
                                                                                                            
                                                            | 7484 | 7484 |  				if (strlen($hour) < 2) { | 
                                                                                                            
                                                            | 7485 |  | -					$hour = "0" . $hour; | 
                                                                                                            
                                                            |  | 7485 | +					$hour = "0".$hour; | 
                                                                                                            
                                                            | 7486 | 7486 |  				} | 
                                                                                                            
                                                            | 7487 |  | -				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; | 
                                                                                                            
                                                            |  | 7487 | +				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; | 
                                                                                                            
                                                            | 7488 | 7488 |  				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); | 
                                                                                                            
                                                            | 7489 | 7489 |  				$retstring .= '</option>'; | 
                                                                                                            
                                                            | 7490 | 7490 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -7497,17 +7497,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7497 | 7497 |   | 
                                                                                                            
                                                            | 7498 | 7498 |  		if ($m) { | 
                                                                                                            
                                                            | 7499 | 7499 |  			// Show minutes | 
                                                                                                            
                                                            | 7500 |  | -			$retstring .= '<select ' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; | 
                                                                                                            
                                                            |  | 7500 | +			$retstring .= '<select '.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; | 
                                                                                                            
                                                            | 7501 | 7501 |  			if ($emptyhours) { | 
                                                                                                            
                                                            | 7502 | 7502 |  				$retstring .= '<option value="-1"> </option>'; | 
                                                                                                            
                                                            | 7503 | 7503 |  			} | 
                                                                                                            
                                                            | 7504 | 7504 |  			for ($min = 0; $min < 60; $min += $stepminutes) { | 
                                                                                                            
                                                            | 7505 | 7505 |  				$min_str = sprintf("%02d", $min); | 
                                                                                                            
                                                            | 7506 |  | -				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; | 
                                                                                                            
                                                            |  | 7506 | +				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; | 
                                                                                                            
                                                            | 7507 | 7507 |  			} | 
                                                                                                            
                                                            | 7508 | 7508 |  			$retstring .= '</select>'; | 
                                                                                                            
                                                            | 7509 | 7509 |   | 
                                                                                                            
                                                            | 7510 |  | -			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; | 
                                                                                                            
                                                            |  | 7510 | +			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; | 
                                                                                                            
                                                            | 7511 | 7511 |  		} | 
                                                                                                            
                                                            | 7512 | 7512 |   | 
                                                                                                            
                                                            | 7513 | 7513 |  		if ($d && $h) { | 
                                                                                                                                                        
                                                        |  | @@ -7530,10 +7530,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7530 | 7530 |   | 
                                                                                                            
                                                            | 7531 | 7531 |  			// Generate the date part, depending on the use or not of the javascript calendar | 
                                                                                                            
                                                            | 7532 | 7532 |  			if ($addnowlink == 1) { // server time expressed in user time setup | 
                                                                                                            
                                                            | 7533 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7534 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7535 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7536 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            |  | 7533 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7534 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7535 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7536 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            | 7537 | 7537 |  			} elseif ($addnowlink == 2) { | 
                                                                                                            
                                                            | 7538 | 7538 |  				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. | 
                                                                                                            
                                                            | 7539 | 7539 |  				 * This break application for foreign languages. | 
                                                                                                                                                        
                                                        |  | @@ -7542,10 +7542,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7542 | 7542 |  				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; | 
                                                                                                            
                                                            | 7543 | 7543 |  				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; | 
                                                                                                            
                                                            | 7544 | 7544 |  				*/ | 
                                                                                                            
                                                            | 7545 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7546 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7547 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7548 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            |  | 7545 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7546 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7547 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7548 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            | 7549 | 7549 |  			} | 
                                                                                                            
                                                            | 7550 | 7550 |  			/*if ($usecalendar == "eldy") | 
                                                                                                            
                                                            | 7551 | 7551 |  			{ | 
                                                                                                                                                        
                                                        |  | @@ -7565,11 +7565,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7565 | 7565 |  				} | 
                                                                                                            
                                                            | 7566 | 7566 |  				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; | 
                                                                                                            
                                                            | 7567 | 7567 |  				if ($addnowlink == 1) { | 
                                                                                                            
                                                            | 7568 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7569 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; | 
                                                                                                            
                                                            |  | 7568 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7569 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; | 
                                                                                                            
                                                            | 7570 | 7570 |  				} elseif ($addnowlink == 2) { | 
                                                                                                            
                                                            | 7571 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; | 
                                                                                                            
                                                            | 7572 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; | 
                                                                                                            
                                                            |  | 7571 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; | 
                                                                                                            
                                                            |  | 7572 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; | 
                                                                                                            
                                                            | 7573 | 7573 |  				} | 
                                                                                                            
                                                            | 7574 | 7574 |   | 
                                                                                                            
                                                            | 7575 | 7575 |  				if ($fullday) { | 
                                                                                                                                                        
                                                        |  | @@ -7583,11 +7583,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7583 | 7583 |  				} | 
                                                                                                            
                                                            | 7584 | 7584 |  				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; | 
                                                                                                            
                                                            | 7585 | 7585 |  				if ($addnowlink == 1) { | 
                                                                                                            
                                                            | 7586 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7587 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; | 
                                                                                                            
                                                            |  | 7586 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7587 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; | 
                                                                                                            
                                                            | 7588 | 7588 |  				} elseif ($addnowlink == 2) { | 
                                                                                                            
                                                            | 7589 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; | 
                                                                                                            
                                                            | 7590 |  | -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; | 
                                                                                                            
                                                            |  | 7589 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; | 
                                                                                                            
                                                            |  | 7590 | +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; | 
                                                                                                            
                                                            | 7591 | 7591 |  				} | 
                                                                                                            
                                                            | 7592 | 7592 |  				if ($fullday) { | 
                                                                                                            
                                                            | 7593 | 7593 |  					$reset_scripts .= ' } '; | 
                                                                                                                                                        
                                                        |  | @@ -7595,7 +7595,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7595 | 7595 |  			} | 
                                                                                                            
                                                            | 7596 | 7596 |  			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick | 
                                                                                                            
                                                            | 7597 | 7597 |  			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { | 
                                                                                                            
                                                            | 7598 |  | -				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; | 
                                                                                                            
                                                            |  | 7598 | +				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; | 
                                                                                                            
                                                            | 7599 | 7599 |  				$retstring .= $langs->trans("Now"); | 
                                                                                                            
                                                            | 7600 | 7600 |  				$retstring .= '</button> '; | 
                                                                                                            
                                                            | 7601 | 7601 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -7607,16 +7607,16 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7607 | 7607 |  			$reset_scripts = ""; | 
                                                                                                            
                                                            | 7608 | 7608 |   | 
                                                                                                            
                                                            | 7609 | 7609 |  			// Generate the date part, depending on the use or not of the javascript calendar | 
                                                                                                            
                                                            | 7610 |  | -			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7611 |  | -			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7612 |  | -			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            | 7613 |  | -			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            |  | 7610 | +			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7611 | +			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7612 | +			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            |  | 7613 | +			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            | 7614 | 7614 |  			// Update the hour part | 
                                                                                                            
                                                            | 7615 | 7615 |  			if ($h) { | 
                                                                                                            
                                                            | 7616 | 7616 |  				if ($fullday) { | 
                                                                                                            
                                                            | 7617 | 7617 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                                                                            
                                                            | 7618 | 7618 |  				} | 
                                                                                                            
                                                            | 7619 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            |  | 7619 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            | 7620 | 7620 |  				if ($fullday) { | 
                                                                                                            
                                                            | 7621 | 7621 |  					$reset_scripts .= ' } '; | 
                                                                                                            
                                                            | 7622 | 7622 |  				} | 
                                                                                                                                                        
                                                        |  | @@ -7626,14 +7626,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7626 | 7626 |  				if ($fullday) { | 
                                                                                                            
                                                            | 7627 | 7627 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                                                                            
                                                            | 7628 | 7628 |  				} | 
                                                                                                            
                                                            | 7629 |  | -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; | 
                                                                                                            
                                                            |  | 7629 | +				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; | 
                                                                                                            
                                                            | 7630 | 7630 |  				if ($fullday) { | 
                                                                                                            
                                                            | 7631 | 7631 |  					$reset_scripts .= ' } '; | 
                                                                                                            
                                                            | 7632 | 7632 |  				} | 
                                                                                                            
                                                            | 7633 | 7633 |  			} | 
                                                                                                            
                                                            | 7634 | 7634 |  			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick | 
                                                                                                            
                                                            | 7635 | 7635 |  			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { | 
                                                                                                            
                                                            | 7636 |  | -				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; | 
                                                                                                            
                                                            |  | 7636 | +				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; | 
                                                                                                            
                                                            | 7637 | 7637 |  				$retstring .= $langs->trans("DateStartPlusOne"); | 
                                                                                                            
                                                            | 7638 | 7638 |  				$retstring .= '</button> '; | 
                                                                                                            
                                                            | 7639 | 7639 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -7691,17 +7691,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7691 | 7691 |  			unset($TDurationTypes[$value]); | 
                                                                                                            
                                                            | 7692 | 7692 |  		} | 
                                                                                                            
                                                            | 7693 | 7693 |   | 
                                                                                                            
                                                            | 7694 |  | -		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; | 
                                                                                                            
                                                            |  | 7694 | +		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; | 
                                                                                                            
                                                            | 7695 | 7695 |  		foreach ($TDurationTypes as $key => $typeduration) { | 
                                                                                                            
                                                            | 7696 |  | -			$retstring .= '<option value="' . $key . '"'; | 
                                                                                                            
                                                            |  | 7696 | +			$retstring .= '<option value="'.$key.'"'; | 
                                                                                                            
                                                            | 7697 | 7697 |  			if ($key == $selected) { | 
                                                                                                            
                                                            | 7698 | 7698 |  				$retstring .= " selected"; | 
                                                                                                            
                                                            | 7699 | 7699 |  			} | 
                                                                                                            
                                                            | 7700 |  | -			$retstring .= ">" . $typeduration . "</option>"; | 
                                                                                                            
                                                            |  | 7700 | +			$retstring .= ">".$typeduration."</option>"; | 
                                                                                                            
                                                            | 7701 | 7701 |  		} | 
                                                                                                            
                                                            | 7702 | 7702 |  		$retstring .= "</select>"; | 
                                                                                                            
                                                            | 7703 | 7703 |   | 
                                                                                                            
                                                            | 7704 |  | -		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); | 
                                                                                                            
                                                            |  | 7704 | +		$retstring .= ajax_combobox('select_'.$prefix.'type_duration'); | 
                                                                                                            
                                                            | 7705 | 7705 |   | 
                                                                                                            
                                                            | 7706 | 7706 |  		return $retstring; | 
                                                                                                            
                                                            | 7707 | 7707 |  	} | 
                                                                                                                                                        
                                                        |  | @@ -7733,30 +7733,30 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7733 | 7733 |   | 
                                                                                                            
                                                            | 7734 | 7734 |  		// Hours | 
                                                                                                            
                                                            | 7735 | 7735 |  		if ($iSecond != '') { | 
                                                                                                            
                                                            | 7736 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; | 
                                                                                                            
                                                            |  | 7736 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; | 
                                                                                                            
                                                            | 7737 | 7737 |   | 
                                                                                                            
                                                            | 7738 | 7738 |  			$hourSelected = convertSecondToTime($iSecond, 'allhour'); | 
                                                                                                            
                                                            | 7739 | 7739 |  			$minSelected = convertSecondToTime($iSecond, 'min'); | 
                                                                                                            
                                                            | 7740 | 7740 |  		} | 
                                                                                                            
                                                            | 7741 | 7741 |   | 
                                                                                                            
                                                            | 7742 | 7742 |  		if ($typehour == 'select') { | 
                                                                                                            
                                                            | 7743 |  | -			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; | 
                                                                                                            
                                                            |  | 7743 | +			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; | 
                                                                                                            
                                                            | 7744 | 7744 |  			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours | 
                                                                                                            
                                                            | 7745 |  | -				$retstring .= '<option value="' . $hour . '"'; | 
                                                                                                            
                                                            |  | 7745 | +				$retstring .= '<option value="'.$hour.'"'; | 
                                                                                                            
                                                            | 7746 | 7746 |  				if (is_numeric($hourSelected) && $hourSelected == $hour) { | 
                                                                                                            
                                                            | 7747 | 7747 |  					$retstring .= " selected"; | 
                                                                                                            
                                                            | 7748 | 7748 |  				} | 
                                                                                                            
                                                            | 7749 |  | -				$retstring .= ">" . $hour . "</option>"; | 
                                                                                                            
                                                            |  | 7749 | +				$retstring .= ">".$hour."</option>"; | 
                                                                                                            
                                                            | 7750 | 7750 |  			} | 
                                                                                                            
                                                            | 7751 | 7751 |  			$retstring .= "</select>"; | 
                                                                                                            
                                                            | 7752 | 7752 |  		} elseif ($typehour == 'text' || $typehour == 'textselect') { | 
                                                                                                            
                                                            | 7753 |  | -			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; | 
                                                                                                            
                                                            |  | 7753 | +			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; | 
                                                                                                            
                                                            | 7754 | 7754 |  		} else { | 
                                                                                                            
                                                            | 7755 | 7755 |  			return 'BadValueForParameterTypeHour'; | 
                                                                                                            
                                                            | 7756 | 7756 |  		} | 
                                                                                                            
                                                            | 7757 | 7757 |   | 
                                                                                                            
                                                            | 7758 | 7758 |  		if ($typehour != 'text') { | 
                                                                                                            
                                                            | 7759 |  | -			$retstring .= ' ' . $langs->trans('HourShort'); | 
                                                                                                            
                                                            |  | 7759 | +			$retstring .= ' '.$langs->trans('HourShort'); | 
                                                                                                            
                                                            | 7760 | 7760 |  		} else { | 
                                                                                                            
                                                            | 7761 | 7761 |  			$retstring .= '<span class="">:</span>'; | 
                                                                                                            
                                                            | 7762 | 7762 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -7771,21 +7771,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7771 | 7771 |  		} | 
                                                                                                            
                                                            | 7772 | 7772 |   | 
                                                                                                            
                                                            | 7773 | 7773 |  		if ($typehour == 'select' || $typehour == 'textselect') { | 
                                                                                                            
                                                            | 7774 |  | -			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; | 
                                                                                                            
                                                            |  | 7774 | +			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; | 
                                                                                                            
                                                            | 7775 | 7775 |  			for ($min = 0; $min <= 55; $min += 5) { | 
                                                                                                            
                                                            | 7776 |  | -				$retstring .= '<option value="' . $min . '"'; | 
                                                                                                            
                                                            |  | 7776 | +				$retstring .= '<option value="'.$min.'"'; | 
                                                                                                            
                                                            | 7777 | 7777 |  				if (is_numeric($minSelected) && $minSelected == $min) { | 
                                                                                                            
                                                            | 7778 | 7778 |  					$retstring .= ' selected'; | 
                                                                                                            
                                                            | 7779 | 7779 |  				} | 
                                                                                                            
                                                            | 7780 |  | -				$retstring .= '>' . $min . '</option>'; | 
                                                                                                            
                                                            |  | 7780 | +				$retstring .= '>'.$min.'</option>'; | 
                                                                                                            
                                                            | 7781 | 7781 |  			} | 
                                                                                                            
                                                            | 7782 | 7782 |  			$retstring .= "</select>"; | 
                                                                                                            
                                                            | 7783 | 7783 |  		} elseif ($typehour == 'text') { | 
                                                                                                            
                                                            | 7784 |  | -			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; | 
                                                                                                            
                                                            |  | 7784 | +			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; | 
                                                                                                            
                                                            | 7785 | 7785 |  		} | 
                                                                                                            
                                                            | 7786 | 7786 |   | 
                                                                                                            
                                                            | 7787 | 7787 |  		if ($typehour != 'text') { | 
                                                                                                            
                                                            | 7788 |  | -			$retstring .= ' ' . $langs->trans('MinuteShort'); | 
                                                                                                            
                                                            |  | 7788 | +			$retstring .= ' '.$langs->trans('MinuteShort'); | 
                                                                                                            
                                                            | 7789 | 7789 |  		} | 
                                                                                                            
                                                            | 7790 | 7790 |   | 
                                                                                                            
                                                            | 7791 | 7791 |  		$retstring .= "</span>"; | 
                                                                                                                                                        
                                                        |  | @@ -7833,7 +7833,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7833 | 7833 |  			$placeholder = ''; | 
                                                                                                            
                                                            | 7834 | 7834 |   | 
                                                                                                            
                                                            | 7835 | 7835 |  			if ($selected && empty($selected_input_value)) { | 
                                                                                                            
                                                            | 7836 |  | -				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; | 
                                                                                                            
                                                            |  | 7836 | +				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; | 
                                                                                                            
                                                            | 7837 | 7837 |  				$tickettmpselect = new Ticket($this->db); | 
                                                                                                            
                                                            | 7838 | 7838 |  				$tickettmpselect->fetch($selected); | 
                                                                                                            
                                                            | 7839 | 7839 |  				$selected_input_value = $tickettmpselect->ref; | 
                                                                                                                                                        
                                                        |  | @@ -7841,17 +7841,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7841 | 7841 |  			} | 
                                                                                                            
                                                            | 7842 | 7842 |   | 
                                                                                                            
                                                            | 7843 | 7843 |  			$urloption = ''; | 
                                                                                                            
                                                            | 7844 |  | -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); | 
                                                                                                            
                                                            |  | 7844 | +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); | 
                                                                                                            
                                                            | 7845 | 7845 |   | 
                                                                                                            
                                                            | 7846 | 7846 |  			if (empty($hidelabel)) { | 
                                                                                                            
                                                            | 7847 |  | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                                                                            
                                                            |  | 7847 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                                                                            
                                                            | 7848 | 7848 |  			} elseif ($hidelabel > 1) { | 
                                                                                                            
                                                            | 7849 |  | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                                                                            
                                                            |  | 7849 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                                                                            
                                                            | 7850 | 7850 |  				if ($hidelabel == 2) { | 
                                                                                                            
                                                            | 7851 | 7851 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 7852 | 7852 |  				} | 
                                                                                                            
                                                            | 7853 | 7853 |  			} | 
                                                                                                            
                                                            | 7854 |  | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                                                                            
                                                            |  | 7854 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                                                                            
                                                            | 7855 | 7855 |  			if ($hidelabel == 3) { | 
                                                                                                            
                                                            | 7856 | 7856 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 7857 | 7857 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -7895,8 +7895,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7895 | 7895 |   | 
                                                                                                            
                                                            | 7896 | 7896 |  		$sql = "SELECT "; | 
                                                                                                            
                                                            | 7897 | 7897 |  		$sql .= $selectFields; | 
                                                                                                            
                                                            | 7898 |  | -		$sql .= " FROM " . $this->db->prefix() . "ticket as p"; | 
                                                                                                            
                                                            | 7899 |  | -		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; | 
                                                                                                            
                                                            |  | 7898 | +		$sql .= " FROM ".$this->db->prefix()."ticket as p"; | 
                                                                                                            
                                                            |  | 7899 | +		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; | 
                                                                                                            
                                                            | 7900 | 7900 |   | 
                                                                                                            
                                                            | 7901 | 7901 |  		// Add criteria on ref/label | 
                                                                                                            
                                                            | 7902 | 7902 |  		if ($filterkey != '') { | 
                                                                                                                                                        
                                                        |  | @@ -7912,7 +7912,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7912 | 7912 |  				if ($i > 0) { | 
                                                                                                            
                                                            | 7913 | 7913 |  					$sql .= " AND "; | 
                                                                                                            
                                                            | 7914 | 7914 |  				} | 
                                                                                                            
                                                            | 7915 |  | -				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 7915 | +				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 7916 | 7916 |  				$sql .= ")"; | 
                                                                                                            
                                                            | 7917 | 7917 |  				$i++; | 
                                                                                                            
                                                            | 7918 | 7918 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -7925,22 +7925,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7925 | 7925 |  		$sql .= $this->db->plimit($limit, 0); | 
                                                                                                            
                                                            | 7926 | 7926 |   | 
                                                                                                            
                                                            | 7927 | 7927 |  		// Build output string | 
                                                                                                            
                                                            | 7928 |  | -		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 7928 | +		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); | 
                                                                                                            
                                                            | 7929 | 7929 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 7930 | 7930 |  		if ($result) { | 
                                                                                                            
                                                            | 7931 |  | -			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; | 
                                                                                                            
                                                            | 7932 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; | 
                                                                                                            
                                                            |  | 7931 | +			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; | 
                                                                                                            
                                                            |  | 7932 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; | 
                                                                                                            
                                                            | 7933 | 7933 |   | 
                                                                                                            
                                                            | 7934 | 7934 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 7935 | 7935 |   | 
                                                                                                            
                                                            | 7936 | 7936 |  			$events = array(); | 
                                                                                                            
                                                            | 7937 | 7937 |   | 
                                                                                                            
                                                            | 7938 | 7938 |  			if (!$forcecombo) { | 
                                                                                                            
                                                            | 7939 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 7939 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 7940 | 7940 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT')); | 
                                                                                                            
                                                            | 7941 | 7941 |  			} | 
                                                                                                            
                                                            | 7942 | 7942 |   | 
                                                                                                            
                                                            | 7943 |  | -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 7943 | +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 7944 | 7944 |   | 
                                                                                                            
                                                            | 7945 | 7945 |  			$textifempty = ''; | 
                                                                                                            
                                                            | 7946 | 7946 |  			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. | 
                                                                                                                                                        
                                                        |  | @@ -7957,7 +7957,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 7957 | 7957 |  				} | 
                                                                                                            
                                                            | 7958 | 7958 |  			} | 
                                                                                                            
                                                            | 7959 | 7959 |  			if ($showempty) { | 
                                                                                                            
                                                            | 7960 |  | -				$out .= '<option value="0" selected>' . $textifempty . '</option>'; | 
                                                                                                            
                                                            |  | 7960 | +				$out .= '<option value="0" selected>'.$textifempty.'</option>'; | 
                                                                                                            
                                                            | 7961 | 7961 |  			} | 
                                                                                                            
                                                            | 7962 | 7962 |   | 
                                                                                                            
                                                            | 7963 | 7963 |  			$i = 0; | 
                                                                                                                                                        
                                                        |  | @@ -8012,13 +8012,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8012 | 8012 |  		$outkey = $objp->rowid; | 
                                                                                                            
                                                            | 8013 | 8013 |  		$outref = $objp->ref; | 
                                                                                                            
                                                            | 8014 | 8014 |   | 
                                                                                                            
                                                            | 8015 |  | -		$opt = '<option value="' . $objp->rowid . '"'; | 
                                                                                                            
                                                            |  | 8015 | +		$opt = '<option value="'.$objp->rowid.'"'; | 
                                                                                                            
                                                            | 8016 | 8016 |  		$opt .= ($objp->rowid == $selected) ? ' selected' : ''; | 
                                                                                                            
                                                            | 8017 | 8017 |  		$opt .= '>'; | 
                                                                                                            
                                                            | 8018 | 8018 |  		$opt .= $objp->ref; | 
                                                                                                            
                                                            | 8019 | 8019 |  		$objRef = $objp->ref; | 
                                                                                                            
                                                            | 8020 | 8020 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                                                                            
                                                            | 8021 |  | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                                                                            
                                                            |  | 8021 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                                                                            
                                                            | 8022 | 8022 |  		} | 
                                                                                                            
                                                            | 8023 | 8023 |   | 
                                                                                                            
                                                            | 8024 | 8024 |  		$opt .= "</option>\n"; | 
                                                                                                                                                        
                                                        |  | @@ -8059,7 +8059,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8059 | 8059 |  			$placeholder = ''; | 
                                                                                                            
                                                            | 8060 | 8060 |   | 
                                                                                                            
                                                            | 8061 | 8061 |  			if ($selected && empty($selected_input_value)) { | 
                                                                                                            
                                                            | 8062 |  | -				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | 
                                                                                                            
                                                            |  | 8062 | +				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | 
                                                                                                            
                                                            | 8063 | 8063 |  				$projecttmpselect = new Project($this->db); | 
                                                                                                            
                                                            | 8064 | 8064 |  				$projecttmpselect->fetch($selected); | 
                                                                                                            
                                                            | 8065 | 8065 |  				$selected_input_value = $projecttmpselect->ref; | 
                                                                                                                                                        
                                                        |  | @@ -8067,17 +8067,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8067 | 8067 |  			} | 
                                                                                                            
                                                            | 8068 | 8068 |   | 
                                                                                                            
                                                            | 8069 | 8069 |  			$urloption = ''; | 
                                                                                                            
                                                            | 8070 |  | -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); | 
                                                                                                            
                                                            |  | 8070 | +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); | 
                                                                                                            
                                                            | 8071 | 8071 |   | 
                                                                                                            
                                                            | 8072 | 8072 |  			if (empty($hidelabel)) { | 
                                                                                                            
                                                            | 8073 |  | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                                                                            
                                                            |  | 8073 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                                                                            
                                                            | 8074 | 8074 |  			} elseif ($hidelabel > 1) { | 
                                                                                                            
                                                            | 8075 |  | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                                                                            
                                                            |  | 8075 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                                                                            
                                                            | 8076 | 8076 |  				if ($hidelabel == 2) { | 
                                                                                                            
                                                            | 8077 | 8077 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 8078 | 8078 |  				} | 
                                                                                                            
                                                            | 8079 | 8079 |  			} | 
                                                                                                            
                                                            | 8080 |  | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                                                                            
                                                            |  | 8080 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                                                                            
                                                            | 8081 | 8081 |  			if ($hidelabel == 3) { | 
                                                                                                            
                                                            | 8082 | 8082 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 8083 | 8083 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -8120,8 +8120,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8120 | 8120 |   | 
                                                                                                            
                                                            | 8121 | 8121 |  		$sql = "SELECT "; | 
                                                                                                            
                                                            | 8122 | 8122 |  		$sql .= $selectFields; | 
                                                                                                            
                                                            | 8123 |  | -		$sql .= " FROM " . $this->db->prefix() . "projet as p"; | 
                                                                                                            
                                                            | 8124 |  | -		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; | 
                                                                                                            
                                                            |  | 8123 | +		$sql .= " FROM ".$this->db->prefix()."projet as p"; | 
                                                                                                            
                                                            |  | 8124 | +		$sql .= ' WHERE p.entity IN ('.getEntity('project').')'; | 
                                                                                                            
                                                            | 8125 | 8125 |   | 
                                                                                                            
                                                            | 8126 | 8126 |  		// Add criteria on ref/label | 
                                                                                                            
                                                            | 8127 | 8127 |  		if ($filterkey != '') { | 
                                                                                                                                                        
                                                        |  | @@ -8137,7 +8137,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8137 | 8137 |  				if ($i > 0) { | 
                                                                                                            
                                                            | 8138 | 8138 |  					$sql .= " AND "; | 
                                                                                                            
                                                            | 8139 | 8139 |  				} | 
                                                                                                            
                                                            | 8140 |  | -				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            |  | 8140 | +				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            | 8141 | 8141 |  				$sql .= ""; | 
                                                                                                            
                                                            | 8142 | 8142 |  				$i++; | 
                                                                                                            
                                                            | 8143 | 8143 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -8150,22 +8150,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8150 | 8150 |  		$sql .= $this->db->plimit($limit, 0); | 
                                                                                                            
                                                            | 8151 | 8151 |   | 
                                                                                                            
                                                            | 8152 | 8152 |  		// Build output string | 
                                                                                                            
                                                            | 8153 |  | -		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 8153 | +		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); | 
                                                                                                            
                                                            | 8154 | 8154 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 8155 | 8155 |  		if ($result) { | 
                                                                                                            
                                                            | 8156 |  | -			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | 
                                                                                                            
                                                            | 8157 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; | 
                                                                                                            
                                                            |  | 8156 | +			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | 
                                                                                                            
                                                            |  | 8157 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; | 
                                                                                                            
                                                            | 8158 | 8158 |   | 
                                                                                                            
                                                            | 8159 | 8159 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 8160 | 8160 |   | 
                                                                                                            
                                                            | 8161 | 8161 |  			$events = array(); | 
                                                                                                            
                                                            | 8162 | 8162 |   | 
                                                                                                            
                                                            | 8163 | 8163 |  			if (!$forcecombo) { | 
                                                                                                            
                                                            | 8164 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 8164 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 8165 | 8165 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT')); | 
                                                                                                            
                                                            | 8166 | 8166 |  			} | 
                                                                                                            
                                                            | 8167 | 8167 |   | 
                                                                                                            
                                                            | 8168 |  | -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 8168 | +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 8169 | 8169 |   | 
                                                                                                            
                                                            | 8170 | 8170 |  			$textifempty = ''; | 
                                                                                                            
                                                            | 8171 | 8171 |  			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. | 
                                                                                                                                                        
                                                        |  | @@ -8182,7 +8182,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8182 | 8182 |  				} | 
                                                                                                            
                                                            | 8183 | 8183 |  			} | 
                                                                                                            
                                                            | 8184 | 8184 |  			if ($showempty) { | 
                                                                                                            
                                                            | 8185 |  | -				$out .= '<option value="0" selected>' . $textifempty . '</option>'; | 
                                                                                                            
                                                            |  | 8185 | +				$out .= '<option value="0" selected>'.$textifempty.'</option>'; | 
                                                                                                            
                                                            | 8186 | 8186 |  			} | 
                                                                                                            
                                                            | 8187 | 8187 |   | 
                                                                                                            
                                                            | 8188 | 8188 |  			$i = 0; | 
                                                                                                                                                        
                                                        |  | @@ -8240,13 +8240,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8240 | 8240 |  		$outlabel = $objp->label; | 
                                                                                                            
                                                            | 8241 | 8241 |  		$outtype = $objp->fk_product_type; | 
                                                                                                            
                                                            | 8242 | 8242 |   | 
                                                                                                            
                                                            | 8243 |  | -		$opt = '<option value="' . $objp->rowid . '"'; | 
                                                                                                            
                                                            |  | 8243 | +		$opt = '<option value="'.$objp->rowid.'"'; | 
                                                                                                            
                                                            | 8244 | 8244 |  		$opt .= ($objp->rowid == $selected) ? ' selected' : ''; | 
                                                                                                            
                                                            | 8245 | 8245 |  		$opt .= '>'; | 
                                                                                                            
                                                            | 8246 | 8246 |  		$opt .= $objp->ref; | 
                                                                                                            
                                                            | 8247 | 8247 |  		$objRef = $objp->ref; | 
                                                                                                            
                                                            | 8248 | 8248 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                                                                            
                                                            | 8249 |  | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                                                                            
                                                            |  | 8249 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                                                                            
                                                            | 8250 | 8250 |  		} | 
                                                                                                            
                                                            | 8251 | 8251 |   | 
                                                                                                            
                                                            | 8252 | 8252 |  		$opt .= "</option>\n"; | 
                                                                                                                                                        
                                                        |  | @@ -8288,7 +8288,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8288 | 8288 |  			$placeholder = ''; | 
                                                                                                            
                                                            | 8289 | 8289 |   | 
                                                                                                            
                                                            | 8290 | 8290 |  			if ($selected && empty($selected_input_value)) { | 
                                                                                                            
                                                            | 8291 |  | -				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; | 
                                                                                                            
                                                            |  | 8291 | +				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; | 
                                                                                                            
                                                            | 8292 | 8292 |  				$adherenttmpselect = new Adherent($this->db); | 
                                                                                                            
                                                            | 8293 | 8293 |  				$adherenttmpselect->fetch($selected); | 
                                                                                                            
                                                            | 8294 | 8294 |  				$selected_input_value = $adherenttmpselect->ref; | 
                                                                                                                                                        
                                                        |  | @@ -8297,17 +8297,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8297 | 8297 |   | 
                                                                                                            
                                                            | 8298 | 8298 |  			$urloption = ''; | 
                                                                                                            
                                                            | 8299 | 8299 |   | 
                                                                                                            
                                                            | 8300 |  | -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); | 
                                                                                                            
                                                            |  | 8300 | +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); | 
                                                                                                            
                                                            | 8301 | 8301 |   | 
                                                                                                            
                                                            | 8302 | 8302 |  			if (empty($hidelabel)) { | 
                                                                                                            
                                                            | 8303 |  | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                                                                            
                                                            |  | 8303 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                                                                            
                                                            | 8304 | 8304 |  			} elseif ($hidelabel > 1) { | 
                                                                                                            
                                                            | 8305 |  | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                                                                            
                                                            |  | 8305 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                                                                            
                                                            | 8306 | 8306 |  				if ($hidelabel == 2) { | 
                                                                                                            
                                                            | 8307 | 8307 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 8308 | 8308 |  				} | 
                                                                                                            
                                                            | 8309 | 8309 |  			} | 
                                                                                                            
                                                            | 8310 |  | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                                                                            
                                                            |  | 8310 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                                                                            
                                                            | 8311 | 8311 |  			if ($hidelabel == 3) { | 
                                                                                                            
                                                            | 8312 | 8312 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                                                                            
                                                            | 8313 | 8313 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -8352,8 +8352,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8352 | 8352 |   | 
                                                                                                            
                                                            | 8353 | 8353 |  		$sql = "SELECT "; | 
                                                                                                            
                                                            | 8354 | 8354 |  		$sql .= $selectFields; | 
                                                                                                            
                                                            | 8355 |  | -		$sql .= " FROM " . $this->db->prefix() . "adherent as p"; | 
                                                                                                            
                                                            | 8356 |  | -		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; | 
                                                                                                            
                                                            |  | 8355 | +		$sql .= " FROM ".$this->db->prefix()."adherent as p"; | 
                                                                                                            
                                                            |  | 8356 | +		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; | 
                                                                                                            
                                                            | 8357 | 8357 |   | 
                                                                                                            
                                                            | 8358 | 8358 |  		// Add criteria on ref/label | 
                                                                                                            
                                                            | 8359 | 8359 |  		if ($filterkey != '') { | 
                                                                                                                                                        
                                                        |  | @@ -8369,8 +8369,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8369 | 8369 |  				if ($i > 0) { | 
                                                                                                            
                                                            | 8370 | 8370 |  					$sql .= " AND "; | 
                                                                                                            
                                                            | 8371 | 8371 |  				} | 
                                                                                                            
                                                            | 8372 |  | -				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; | 
                                                                                                            
                                                            | 8373 |  | -				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; | 
                                                                                                            
                                                            |  | 8372 | +				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; | 
                                                                                                            
                                                            |  | 8373 | +				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; | 
                                                                                                            
                                                            | 8374 | 8374 |  				$i++; | 
                                                                                                            
                                                            | 8375 | 8375 |  			} | 
                                                                                                            
                                                            | 8376 | 8376 |  			if (count($search_crit) > 1) { | 
                                                                                                                                                        
                                                        |  | @@ -8379,27 +8379,27 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8379 | 8379 |  			$sql .= ')'; | 
                                                                                                            
                                                            | 8380 | 8380 |  		} | 
                                                                                                            
                                                            | 8381 | 8381 |  		if ($status != -1) { | 
                                                                                                            
                                                            | 8382 |  | -			$sql .= ' AND statut = ' . ((int) $status); | 
                                                                                                            
                                                            |  | 8382 | +			$sql .= ' AND statut = '.((int) $status); | 
                                                                                                            
                                                            | 8383 | 8383 |  		} | 
                                                                                                            
                                                            | 8384 | 8384 |  		$sql .= $this->db->plimit($limit, 0); | 
                                                                                                            
                                                            | 8385 | 8385 |   | 
                                                                                                            
                                                            | 8386 | 8386 |  		// Build output string | 
                                                                                                            
                                                            | 8387 |  | -		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 8387 | +		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); | 
                                                                                                            
                                                            | 8388 | 8388 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 8389 | 8389 |  		if ($result) { | 
                                                                                                            
                                                            | 8390 |  | -			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; | 
                                                                                                            
                                                            | 8391 |  | -			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; | 
                                                                                                            
                                                            |  | 8390 | +			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; | 
                                                                                                            
                                                            |  | 8391 | +			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; | 
                                                                                                            
                                                            | 8392 | 8392 |   | 
                                                                                                            
                                                            | 8393 | 8393 |  			$num = $this->db->num_rows($result); | 
                                                                                                            
                                                            | 8394 | 8394 |   | 
                                                                                                            
                                                            | 8395 | 8395 |  			$events = array(); | 
                                                                                                            
                                                            | 8396 | 8396 |   | 
                                                                                                            
                                                            | 8397 | 8397 |  			if (!$forcecombo) { | 
                                                                                                            
                                                            | 8398 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 8398 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 8399 | 8399 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); | 
                                                                                                            
                                                            | 8400 | 8400 |  			} | 
                                                                                                            
                                                            | 8401 | 8401 |   | 
                                                                                                            
                                                            | 8402 |  | -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 8402 | +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 8403 | 8403 |   | 
                                                                                                            
                                                            | 8404 | 8404 |  			$textifempty = ''; | 
                                                                                                            
                                                            | 8405 | 8405 |  			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. | 
                                                                                                                                                        
                                                        |  | @@ -8416,7 +8416,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8416 | 8416 |  				} | 
                                                                                                            
                                                            | 8417 | 8417 |  			} | 
                                                                                                            
                                                            | 8418 | 8418 |  			if ($showempty) { | 
                                                                                                            
                                                            | 8419 |  | -				$out .= '<option value="-1" selected>' . $textifempty . '</option>'; | 
                                                                                                            
                                                            |  | 8419 | +				$out .= '<option value="-1" selected>'.$textifempty.'</option>'; | 
                                                                                                            
                                                            | 8420 | 8420 |  			} | 
                                                                                                            
                                                            | 8421 | 8421 |   | 
                                                                                                            
                                                            | 8422 | 8422 |  			$i = 0; | 
                                                                                                                                                        
                                                        |  | @@ -8472,11 +8472,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8472 | 8472 |  		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); | 
                                                                                                            
                                                            | 8473 | 8473 |  		$outtype = $objp->fk_adherent_type; | 
                                                                                                            
                                                            | 8474 | 8474 |   | 
                                                                                                            
                                                            | 8475 |  | -		$opt = '<option value="' . $objp->rowid . '"'; | 
                                                                                                            
                                                            |  | 8475 | +		$opt = '<option value="'.$objp->rowid.'"'; | 
                                                                                                            
                                                            | 8476 | 8476 |  		$opt .= ($objp->rowid == $selected) ? ' selected' : ''; | 
                                                                                                            
                                                            | 8477 | 8477 |  		$opt .= '>'; | 
                                                                                                            
                                                            | 8478 | 8478 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                                                                            
                                                            | 8479 |  | -			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                                                                            
                                                            |  | 8479 | +			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                                                                            
                                                            | 8480 | 8480 |  		} | 
                                                                                                            
                                                            | 8481 | 8481 |  		$opt .= $outlabel; | 
                                                                                                            
                                                            | 8482 | 8482 |  		$opt .= "</option>\n"; | 
                                                                                                                                                        
                                                        |  | @@ -8533,8 +8533,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8533 | 8533 |  		$objecttmp = null; | 
                                                                                                            
                                                            | 8534 | 8534 |  		$InfoFieldList = array(); | 
                                                                                                            
                                                            | 8535 | 8535 |  		$classname = ''; | 
                                                                                                            
                                                            | 8536 |  | -		$filter = '';  // Ensure filter has value (for static analysis) | 
                                                                                                            
                                                            | 8537 |  | -		$sortfield = '';  // Ensure filter has value (for static analysis) | 
                                                                                                            
                                                            |  | 8536 | +		$filter = ''; // Ensure filter has value (for static analysis) | 
                                                                                                            
                                                            |  | 8537 | +		$sortfield = ''; // Ensure filter has value (for static analysis) | 
                                                                                                            
                                                            | 8538 | 8538 |   | 
                                                                                                            
                                                            | 8539 | 8539 |  		if (is_array($objectfield)) { | 
                                                                                                            
                                                            | 8540 | 8540 |  			$objectdesc = $objectfield['type']; | 
                                                                                                                                                        
                                                        |  | @@ -8581,9 +8581,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8581 | 8581 |  			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); | 
                                                                                                            
                                                            | 8582 | 8582 |  			$reg = array(); | 
                                                                                                            
                                                            | 8583 | 8583 |  			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { | 
                                                                                                            
                                                            | 8584 |  | -				$InfoFieldList[4] = $reg[1];    // take the sort field | 
                                                                                                            
                                                            |  | 8584 | +				$InfoFieldList[4] = $reg[1]; // take the sort field | 
                                                                                                            
                                                            | 8585 | 8585 |  			} | 
                                                                                                            
                                                            | 8586 |  | -			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field | 
                                                                                                            
                                                            |  | 8586 | +			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field | 
                                                                                                            
                                                            | 8587 | 8587 |   | 
                                                                                                            
                                                            | 8588 | 8588 |  			$classname = $InfoFieldList[0]; | 
                                                                                                            
                                                            | 8589 | 8589 |  			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; | 
                                                                                                                                                        
                                                        |  | @@ -8614,8 +8614,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8614 | 8614 |  		); | 
                                                                                                            
                                                            | 8615 | 8615 |   | 
                                                                                                            
                                                            | 8616 | 8616 |  		if (!is_object($objecttmp)) { | 
                                                                                                            
                                                            | 8617 |  | -			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                                                                            
                                                            | 8618 |  | -			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; | 
                                                                                                            
                                                            |  | 8617 | +			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                                                                            
                                                            |  | 8618 | +			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; | 
                                                                                                            
                                                            | 8619 | 8619 |  		} | 
                                                                                                            
                                                            | 8620 | 8620 |  		'@phan-var-force CommonObject $objecttmp'; | 
                                                                                                            
                                                            | 8621 | 8621 |  		/** @var CommonObject $objecttmp */ | 
                                                                                                                                                        
                                                        |  | @@ -8627,9 +8627,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8627 | 8627 |  		if ($prefixforautocompletemode == 'product') { | 
                                                                                                            
                                                            | 8628 | 8628 |  			$prefixforautocompletemode = 'produit'; | 
                                                                                                            
                                                            | 8629 | 8629 |  		} | 
                                                                                                            
                                                            | 8630 |  | -		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT | 
                                                                                                            
                                                            |  | 8630 | +		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT | 
                                                                                                            
                                                            | 8631 | 8631 |   | 
                                                                                                            
                                                            | 8632 |  | -		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 8632 | +		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); | 
                                                                                                            
                                                            | 8633 | 8633 |   | 
                                                                                                            
                                                            | 8634 | 8634 |  		// Generate the combo HTML component | 
                                                                                                            
                                                            | 8635 | 8635 |  		$out = ''; | 
                                                                                                                                                        
                                                        |  | @@ -8658,13 +8658,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8658 | 8658 |  			} | 
                                                                                                            
                                                            | 8659 | 8659 |   | 
                                                                                                            
                                                            | 8660 | 8660 |  			// Set url and param to call to get json of the search results | 
                                                                                                            
                                                            | 8661 |  | -			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; | 
                                                                                                            
                                                            | 8662 |  | -			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); | 
                                                                                                            
                                                            |  | 8661 | +			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; | 
                                                                                                            
                                                            |  | 8662 | +			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); | 
                                                                                                            
                                                            | 8663 | 8663 |   | 
                                                                                                            
                                                            | 8664 | 8664 |  			// Activate the auto complete using ajax call. | 
                                                                                                            
                                                            | 8665 | 8665 |  			$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0); | 
                                                                                                            
                                                            | 8666 | 8666 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                                                                            
                                                            | 8667 |  | -			$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) . '"' : '') . ' />'; | 
                                                                                                            
                                                            |  | 8667 | +			$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).'"' : '').' />'; | 
                                                                                                            
                                                            | 8668 | 8668 |  		} else { | 
                                                                                                            
                                                            | 8669 | 8669 |  			// Immediate load of table record. | 
                                                                                                            
                                                            | 8670 | 8670 |  			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); | 
                                                                                                                                                        
                                                        |  | @@ -8704,16 +8704,16 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8704 | 8704 |  		if ($prefixforautocompletemode == 'societe') { | 
                                                                                                            
                                                            | 8705 | 8705 |  			$prefixforautocompletemode = 'company'; | 
                                                                                                            
                                                            | 8706 | 8706 |  		} | 
                                                                                                            
                                                            | 8707 |  | -		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT | 
                                                                                                            
                                                            |  | 8707 | +		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT | 
                                                                                                            
                                                            | 8708 | 8708 |   | 
                                                                                                            
                                                            | 8709 | 8709 |  		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...) | 
                                                                                                            
                                                            | 8710 | 8710 |  			$tmpfieldstoshow = ''; | 
                                                                                                            
                                                            | 8711 | 8711 |  			foreach ($objecttmp->fields as $key => $val) { | 
                                                                                                            
                                                            | 8712 |  | -				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                                                                            
                                                            |  | 8712 | +				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                                                                            
                                                            | 8713 | 8713 |  					continue; | 
                                                                                                            
                                                            | 8714 | 8714 |  				} | 
                                                                                                            
                                                            | 8715 | 8715 |  				if (!empty($val['showoncombobox'])) { | 
                                                                                                            
                                                            | 8716 |  | -					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; | 
                                                                                                            
                                                            |  | 8716 | +					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; | 
                                                                                                            
                                                            | 8717 | 8717 |  				} | 
                                                                                                            
                                                            | 8718 | 8718 |  			} | 
                                                                                                            
                                                            | 8719 | 8719 |  			if ($tmpfieldstoshow) { | 
                                                                                                                                                        
                                                        |  | @@ -8750,25 +8750,25 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8750 | 8750 |  		$num = 0; | 
                                                                                                            
                                                            | 8751 | 8751 |   | 
                                                                                                            
                                                            | 8752 | 8752 |  		// Search data | 
                                                                                                            
                                                            | 8753 |  | -		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t"; | 
                                                                                                            
                                                            |  | 8753 | +		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)." as t"; | 
                                                                                                            
                                                            | 8754 | 8754 |  		if (!empty($objecttmp->isextrafieldmanaged)) { | 
                                                                                                            
                                                            | 8755 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object"; | 
                                                                                                            
                                                            |  | 8755 | +			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)."_extrafields as e ON t.rowid = e.fk_object"; | 
                                                                                                            
                                                            | 8756 | 8756 |  		} | 
                                                                                                            
                                                            | 8757 | 8757 |  		if (!empty($objecttmp->parent_element)) { | 
                                                                                                            
                                                            | 8758 | 8758 |  			$parent_properties = getElementProperties($objecttmp->parent_element); | 
                                                                                                            
                                                            | 8759 |  | -			$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute; | 
                                                                                                            
                                                            |  | 8759 | +			$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($parent_properties['table_element'])." as o ON o.rowid = t.".$objecttmp->fk_parent_attribute; | 
                                                                                                            
                                                            | 8760 | 8760 |  		} | 
                                                                                                            
                                                            | 8761 | 8761 |  		if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) { | 
                                                                                                            
                                                            | 8762 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product"; | 
                                                                                                            
                                                            |  | 8762 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = t.fk_product"; | 
                                                                                                            
                                                            | 8763 | 8763 |  		} | 
                                                                                                            
                                                            | 8764 | 8764 |  		if (isset($objecttmp->ismultientitymanaged)) { | 
                                                                                                            
                                                            | 8765 | 8765 |  			if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                                                                            
                                                            | 8766 | 8766 |  				$tmparray = explode('@', $objecttmp->ismultientitymanaged); | 
                                                                                                            
                                                            | 8767 |  | -				$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]); | 
                                                                                                            
                                                            |  | 8767 | +				$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($tmparray[1])." as parenttable ON parenttable.rowid = t.".$this->db->sanitize($tmparray[0]); | 
                                                                                                            
                                                            | 8768 | 8768 |  			} | 
                                                                                                            
                                                            | 8769 | 8769 |  			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                                                                            
                                                            | 8770 | 8770 |  				if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                                                                            
                                                            | 8771 |  | -					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; | 
                                                                                                            
                                                            |  | 8771 | +					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; | 
                                                                                                            
                                                            | 8772 | 8772 |  				} | 
                                                                                                            
                                                            | 8773 | 8773 |  			} | 
                                                                                                            
                                                            | 8774 | 8774 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -8788,21 +8788,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8788 | 8788 |  			$sql .= " WHERE 1=1"; | 
                                                                                                            
                                                            | 8789 | 8789 |  			if (isset($objecttmp->ismultientitymanaged)) { | 
                                                                                                            
                                                            | 8790 | 8790 |  				if ($objecttmp->ismultientitymanaged == 1) { | 
                                                                                                            
                                                            | 8791 |  | -					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; | 
                                                                                                            
                                                            |  | 8791 | +					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; | 
                                                                                                            
                                                            | 8792 | 8792 |  				} | 
                                                                                                            
                                                            | 8793 | 8793 |  				if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                                                                            
                                                            | 8794 |  | -					$sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]); | 
                                                                                                            
                                                            |  | 8794 | +					$sql .= " AND parenttable.entity = t.".$this->db->sanitize($tmparray[0]); | 
                                                                                                            
                                                            | 8795 | 8795 |  				} | 
                                                                                                            
                                                            | 8796 | 8796 |  				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { | 
                                                                                                            
                                                            | 8797 | 8797 |  					if ($objecttmp->element == 'societe') { | 
                                                                                                            
                                                            | 8798 |  | -						$sql .= " AND t.rowid = " . ((int) $user->socid); | 
                                                                                                            
                                                            |  | 8798 | +						$sql .= " AND t.rowid = ".((int) $user->socid); | 
                                                                                                            
                                                            | 8799 | 8799 |  					} else { | 
                                                                                                            
                                                            | 8800 |  | -						$sql .= " AND t.fk_soc = " . ((int) $user->socid); | 
                                                                                                            
                                                            |  | 8800 | +						$sql .= " AND t.fk_soc = ".((int) $user->socid); | 
                                                                                                            
                                                            | 8801 | 8801 |  					} | 
                                                                                                            
                                                            | 8802 | 8802 |  				} | 
                                                                                                            
                                                            | 8803 | 8803 |  				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                                                                            
                                                            | 8804 | 8804 |  					if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                                                                            
                                                            | 8805 |  | -						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); | 
                                                                                                            
                                                            |  | 8805 | +						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); | 
                                                                                                            
                                                            | 8806 | 8806 |  					} | 
                                                                                                            
                                                            | 8807 | 8807 |  				} | 
                                                                                                            
                                                            | 8808 | 8808 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -8820,7 +8820,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8820 | 8820 |  				$errormessage = ''; | 
                                                                                                            
                                                            | 8821 | 8821 |  				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); | 
                                                                                                            
                                                            | 8822 | 8822 |  				if ($errormessage) { | 
                                                                                                            
                                                            | 8823 |  | -					return 'Error forging a SQL request from an universal criteria: ' . $errormessage; | 
                                                                                                            
                                                            |  | 8823 | +					return 'Error forging a SQL request from an universal criteria: '.$errormessage; | 
                                                                                                            
                                                            | 8824 | 8824 |  				} | 
                                                                                                            
                                                            | 8825 | 8825 |  			} | 
                                                                                                            
                                                            | 8826 | 8826 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -8832,7 +8832,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8832 | 8832 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 8833 | 8833 |  		if ($resql) { | 
                                                                                                            
                                                            | 8834 | 8834 |  			// Construct $out and $outarray | 
                                                                                                            
                                                            | 8835 |  | -			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; | 
                                                                                                            
                                                            |  | 8835 | +			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; | 
                                                                                                            
                                                            | 8836 | 8836 |   | 
                                                                                                            
                                                            | 8837 | 8837 |  			// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 | 
                                                                                                            
                                                            | 8838 | 8838 |  			$textifempty = ' '; | 
                                                                                                                                                        
                                                        |  | @@ -8846,7 +8846,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8846 | 8846 |  				} | 
                                                                                                            
                                                            | 8847 | 8847 |  			} | 
                                                                                                            
                                                            | 8848 | 8848 |  			if ($showempty) { | 
                                                                                                            
                                                            | 8849 |  | -				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 8849 | +				$out .= '<option value="-1">'.$textifempty.'</option>'."\n"; | 
                                                                                                            
                                                            | 8850 | 8850 |  			} | 
                                                                                                            
                                                            | 8851 | 8851 |   | 
                                                                                                            
                                                            | 8852 | 8852 |  			$num = $this->db->num_rows($resql); | 
                                                                                                                                                        
                                                        |  | @@ -8869,9 +8869,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8869 | 8869 |  					} | 
                                                                                                            
                                                            | 8870 | 8870 |  					if (empty($outputmode)) { | 
                                                                                                            
                                                            | 8871 | 8871 |  						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { | 
                                                                                                            
                                                            | 8872 |  | -							$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>'; | 
                                                                                                            
                                                            |  | 8872 | +							$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>'; | 
                                                                                                            
                                                            | 8873 | 8873 |  						} else { | 
                                                                                                            
                                                            | 8874 |  | -							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; | 
                                                                                                            
                                                            |  | 8874 | +							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; | 
                                                                                                            
                                                            | 8875 | 8875 |  						} | 
                                                                                                            
                                                            | 8876 | 8876 |  					} else { | 
                                                                                                            
                                                            | 8877 | 8877 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); | 
                                                                                                                                                        
                                                        |  | @@ -8884,10 +8884,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8884 | 8884 |  				} | 
                                                                                                            
                                                            | 8885 | 8885 |  			} | 
                                                                                                            
                                                            | 8886 | 8886 |   | 
                                                                                                            
                                                            | 8887 |  | -			$out .= '</select>' . "\n"; | 
                                                                                                            
                                                            |  | 8887 | +			$out .= '</select>'."\n"; | 
                                                                                                            
                                                            | 8888 | 8888 |   | 
                                                                                                            
                                                            | 8889 | 8889 |  			if (!$forcecombo) { | 
                                                                                                            
                                                            | 8890 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 8890 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 8891 | 8891 |  				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); | 
                                                                                                            
                                                            | 8892 | 8892 |  			} | 
                                                                                                            
                                                            | 8893 | 8893 |  		} else { | 
                                                                                                                                                        
                                                        |  | @@ -8951,8 +8951,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8951 | 8951 |  			} | 
                                                                                                            
                                                            | 8952 | 8952 |  		} | 
                                                                                                            
                                                            | 8953 | 8953 |  		$idname = str_replace(array('[', ']'), array('', ''), $htmlname); | 
                                                                                                            
                                                            | 8954 |  | -		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; | 
                                                                                                            
                                                            | 8955 |  | -		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); | 
                                                                                                            
                                                            |  | 8954 | +		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; | 
                                                                                                            
                                                            |  | 8955 | +		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); | 
                                                                                                            
                                                            | 8956 | 8956 |  		$out .= '>'."\n"; | 
                                                                                                            
                                                            | 8957 | 8957 |   | 
                                                                                                            
                                                            | 8958 | 8958 |  		if ($show_empty) { | 
                                                                                                                                                        
                                                        |  | @@ -8963,7 +8963,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8963 | 8963 |  			if (!is_numeric($show_empty)) { | 
                                                                                                            
                                                            | 8964 | 8964 |  				$textforempty = $show_empty; | 
                                                                                                            
                                                            | 8965 | 8965 |  			} | 
                                                                                                            
                                                            | 8966 |  | -			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 8966 | +			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; | 
                                                                                                            
                                                            | 8967 | 8967 |  		} | 
                                                                                                            
                                                            | 8968 | 8968 |  		if (is_array($array)) { | 
                                                                                                            
                                                            | 8969 | 8969 |  			// Translate | 
                                                                                                                                                        
                                                        |  | @@ -8988,7 +8988,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 8988 | 8988 |  					$value = $tmpvalue['label']; | 
                                                                                                            
                                                            | 8989 | 8989 |  					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; | 
                                                                                                            
                                                            | 8990 | 8990 |  					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; | 
                                                                                                            
                                                            | 8991 |  | -					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; | 
                                                                                                            
                                                            |  | 8991 | +					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; | 
                                                                                                            
                                                            | 8992 | 8992 |  				} else { | 
                                                                                                            
                                                            | 8993 | 8993 |  					$value = $tmpvalue; | 
                                                                                                            
                                                            | 8994 | 8994 |  					//$valuehtml = $tmpvalue; | 
                                                                                                                                                        
                                                        |  | @@ -9004,9 +9004,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9004 | 9004 |  				} | 
                                                                                                            
                                                            | 9005 | 9005 |  				if ($key_in_label) { | 
                                                                                                            
                                                            | 9006 | 9006 |  					if (empty($nohtmlescape)) { | 
                                                                                                            
                                                            | 9007 |  | -						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); | 
                                                                                                            
                                                            |  | 9007 | +						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); | 
                                                                                                            
                                                            | 9008 | 9008 |  					} else { | 
                                                                                                            
                                                            | 9009 |  | -						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); | 
                                                                                                            
                                                            |  | 9009 | +						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); | 
                                                                                                            
                                                            | 9010 | 9010 |  					} | 
                                                                                                            
                                                            | 9011 | 9011 |  				} else { | 
                                                                                                            
                                                            | 9012 | 9012 |  					if (empty($nohtmlescape)) { | 
                                                                                                                                                        
                                                        |  | @@ -9018,8 +9018,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9018 | 9018 |  						$selectOptionValue = ' '; | 
                                                                                                            
                                                            | 9019 | 9019 |  					} | 
                                                                                                            
                                                            | 9020 | 9020 |  				} | 
                                                                                                            
                                                            | 9021 |  | -				$out .= '<option value="' . $key . '"'; | 
                                                                                                            
                                                            | 9022 |  | -				$out .= $style . $disabled; | 
                                                                                                            
                                                            |  | 9021 | +				$out .= '<option value="'.$key.'"'; | 
                                                                                                            
                                                            |  | 9022 | +				$out .= $style.$disabled; | 
                                                                                                            
                                                            | 9023 | 9023 |  				if (is_array($id)) { | 
                                                                                                            
                                                            | 9024 | 9024 |  					if (in_array($key, $id) && !$disabled) { | 
                                                                                                            
                                                            | 9025 | 9025 |  						$out .= ' selected'; // To preselect a value | 
                                                                                                                                                        
                                                        |  | @@ -9031,7 +9031,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9031 | 9031 |  					} | 
                                                                                                            
                                                            | 9032 | 9032 |  				} | 
                                                                                                            
                                                            | 9033 | 9033 |  				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. | 
                                                                                                            
                                                            | 9034 |  | -					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; | 
                                                                                                            
                                                            |  | 9034 | +					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; | 
                                                                                                            
                                                            | 9035 | 9035 |  				} | 
                                                                                                            
                                                            | 9036 | 9036 |   | 
                                                                                                            
                                                            | 9037 | 9037 |  				if (is_array($tmpvalue)) { | 
                                                                                                                                                        
                                                        |  | @@ -9054,7 +9054,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9054 | 9054 |  		// Add code for jquery to use multiselect | 
                                                                                                            
                                                            | 9055 | 9055 |  		if ($addjscombo && $jsbeautify) { | 
                                                                                                            
                                                            | 9056 | 9056 |  			// Enhance with select2 | 
                                                                                                            
                                                            | 9057 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 9057 | +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 9058 | 9058 |  			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); | 
                                                                                                            
                                                            | 9059 | 9059 |  		} | 
                                                                                                            
                                                            | 9060 | 9060 |   | 
                                                                                                                                                        
                                                        |  | @@ -9082,28 +9082,28 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9082 | 9082 |  	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) | 
                                                                                                            
                                                            | 9083 | 9083 |  	{ | 
                                                                                                            
                                                            | 9084 | 9084 |  		global $conf; | 
                                                                                                            
                                                            | 9085 |  | -		global $delayedhtmlcontent;    // Will be used later outside of this function | 
                                                                                                            
                                                            |  | 9085 | +		global $delayedhtmlcontent; // Will be used later outside of this function | 
                                                                                                            
                                                            | 9086 | 9086 |   | 
                                                                                                            
                                                            | 9087 | 9087 |  		// TODO Use an internal dolibarr component instead of select2 | 
                                                                                                            
                                                            | 9088 | 9088 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                                                                            
                                                            | 9089 | 9089 |  			return ''; | 
                                                                                                            
                                                            | 9090 | 9090 |  		} | 
                                                                                                            
                                                            | 9091 | 9091 |   | 
                                                                                                            
                                                            | 9092 |  | -		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; | 
                                                                                                            
                                                            |  | 9092 | +		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; | 
                                                                                                            
                                                            | 9093 | 9093 |   | 
                                                                                                            
                                                            | 9094 | 9094 |  		$outdelayed = ''; | 
                                                                                                            
                                                            | 9095 | 9095 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 9096 | 9096 |  			$tmpplugin = 'select2'; | 
                                                                                                            
                                                            | 9097 |  | -			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> | 
                                                                                                            
                                                            | 9098 |  | -		    	<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 9097 | +			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> | 
                                                                                                            
                                                            |  | 9098 | +		    	<script nonce="' . getNonce().'"> | 
                                                                                                            
                                                            | 9099 | 9099 |  		    	$(document).ready(function () { | 
                                                                                                            
                                                            | 9100 | 9100 |   | 
                                                                                                            
                                                            | 9101 |  | -	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' | 
                                                                                                            
                                                            |  | 9101 | +	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' | 
                                                                                                            
                                                            | 9102 | 9102 |   | 
                                                                                                            
                                                            | 9103 |  | -	                $(".' . $htmlname . '").select2({ | 
                                                                                                            
                                                            |  | 9103 | +	                $(".' . $htmlname.'").select2({ | 
                                                                                                            
                                                            | 9104 | 9104 |  				    	ajax: { | 
                                                                                                            
                                                            | 9105 | 9105 |  					    	dir: "ltr", | 
                                                                                                            
                                                            | 9106 |  | -					    	url: "' . $url . '", | 
                                                                                                            
                                                            |  | 9106 | +					    	url: "' . $url.'", | 
                                                                                                            
                                                            | 9107 | 9107 |  					    	dataType: \'json\', | 
                                                                                                            
                                                            | 9108 | 9108 |  					    	delay: 250, | 
                                                                                                            
                                                            | 9109 | 9109 |  					    	data: function (params) { | 
                                                                                                                                                        
                                                        |  | @@ -9130,9 +9130,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9130 | 9130 |  				    	}, | 
                                                                                                            
                                                            | 9131 | 9131 |  		 				language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage, | 
                                                                                                            
                                                            | 9132 | 9132 |  						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */ | 
                                                                                                            
                                                            | 9133 |  | -					    placeholder: \'' . dol_escape_js($placeholder) . '\', | 
                                                                                                            
                                                            |  | 9133 | +					    placeholder: \'' . dol_escape_js($placeholder).'\', | 
                                                                                                            
                                                            | 9134 | 9134 |  				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                                                                            
                                                            | 9135 |  | -				    	minimumInputLength: ' . ((int) $minimumInputLength) . ', | 
                                                                                                            
                                                            |  | 9135 | +				    	minimumInputLength: ' . ((int) $minimumInputLength).', | 
                                                                                                            
                                                            | 9136 | 9136 |  				        formatResult: function (result, container, query, escapeMarkup) { | 
                                                                                                            
                                                            | 9137 | 9137 |  	                        return escapeMarkup(result.text); | 
                                                                                                            
                                                            | 9138 | 9138 |  	                    }, | 
                                                                                                                                                        
                                                        |  | @@ -9140,10 +9140,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9140 | 9140 |   | 
                                                                                                            
                                                            | 9141 | 9141 |  	                ' . ($callurlonselect ? ' | 
                                                                                                            
                                                            | 9142 | 9142 |  	                /* Code to execute a GET when we select a value */ | 
                                                                                                            
                                                            | 9143 |  | -	                $(".' . $htmlname . '").change(function() { | 
                                                                                                            
                                                            | 9144 |  | -				    	var selected = $(\'.' . dol_escape_js($htmlname) . '\').val(); | 
                                                                                                            
                                                            |  | 9143 | +	                $(".' . $htmlname.'").change(function() { | 
                                                                                                            
                                                            |  | 9144 | +				    	var selected = $(\'.' . dol_escape_js($htmlname).'\').val(); | 
                                                                                                            
                                                            | 9145 | 9145 |  	                	console.log("We select in selectArrayAjax the entry "+selected) | 
                                                                                                            
                                                            | 9146 |  | -				        $(\'.' . dol_escape_js($htmlname) . '\').val("");  /* reset visible combo value */ | 
                                                                                                            
                                                            |  | 9146 | +				        $(\'.' . dol_escape_js($htmlname).'\').val("");  /* reset visible combo value */ | 
                                                                                                            
                                                            | 9147 | 9147 |  	    			    $.each( saveRemoteData, function( key, value ) { | 
                                                                                                            
                                                            | 9148 | 9148 |  	    				        if (key == selected) | 
                                                                                                            
                                                            | 9149 | 9149 |  	    			            { | 
                                                                                                                                                        
                                                        |  | @@ -9151,7 +9151,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9151 | 9151 |  	    			                 location.assign(value.url); | 
                                                                                                            
                                                            | 9152 | 9152 |  	    			            } | 
                                                                                                            
                                                            | 9153 | 9153 |  	                    }); | 
                                                                                                            
                                                            | 9154 |  | -	    			});' : '') . ' | 
                                                                                                            
                                                            |  | 9154 | +	    			});' : '').' | 
                                                                                                            
                                                            | 9155 | 9155 |   | 
                                                                                                            
                                                            | 9156 | 9156 |  	    	   }); | 
                                                                                                            
                                                            | 9157 | 9157 |  		       </script>'; | 
                                                                                                                                                        
                                                        |  | @@ -9187,14 +9187,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9187 | 9187 |  	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') | 
                                                                                                            
                                                            | 9188 | 9188 |  	{ | 
                                                                                                            
                                                            | 9189 | 9189 |  		global $conf; | 
                                                                                                            
                                                            | 9190 |  | -		global $delayedhtmlcontent;    // Will be used later outside of this function | 
                                                                                                            
                                                            |  | 9190 | +		global $delayedhtmlcontent; // Will be used later outside of this function | 
                                                                                                            
                                                            | 9191 | 9191 |   | 
                                                                                                            
                                                            | 9192 | 9192 |  		// TODO Use an internal dolibarr component instead of select2 | 
                                                                                                            
                                                            | 9193 | 9193 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                                                                            
                                                            | 9194 | 9194 |  			return ''; | 
                                                                                                            
                                                            | 9195 | 9195 |  		} | 
                                                                                                            
                                                            | 9196 | 9196 |   | 
                                                                                                            
                                                            | 9197 |  | -		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; | 
                                                                                                            
                                                            |  | 9197 | +		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; | 
                                                                                                            
                                                            | 9198 | 9198 |   | 
                                                                                                            
                                                            | 9199 | 9199 |  		$formattedarrayresult = array(); | 
                                                                                                            
                                                            | 9200 | 9200 |   | 
                                                                                                                                                        
                                                        |  | @@ -9209,20 +9209,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9209 | 9209 |  		$outdelayed = ''; | 
                                                                                                            
                                                            | 9210 | 9210 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 9211 | 9211 |  			$tmpplugin = 'select2'; | 
                                                                                                            
                                                            | 9212 |  | -			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> | 
                                                                                                            
                                                            | 9213 |  | -				<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 9212 | +			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> | 
                                                                                                            
                                                            |  | 9213 | +				<script nonce="' . getNonce().'"> | 
                                                                                                            
                                                            | 9214 | 9214 |  				$(document).ready(function () { | 
                                                                                                            
                                                            | 9215 |  | -					var data = ' . json_encode($formattedarrayresult) . '; | 
                                                                                                            
                                                            |  | 9215 | +					var data = ' . json_encode($formattedarrayresult).'; | 
                                                                                                            
                                                            | 9216 | 9216 |   | 
                                                                                                            
                                                            | 9217 |  | -					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' | 
                                                                                                            
                                                            |  | 9217 | +					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' | 
                                                                                                            
                                                            | 9218 | 9218 |   | 
                                                                                                            
                                                            | 9219 |  | -					$(\'.' . dol_escape_js($htmlname) . '\').select2({ | 
                                                                                                            
                                                            |  | 9219 | +					$(\'.' . dol_escape_js($htmlname).'\').select2({ | 
                                                                                                            
                                                            | 9220 | 9220 |  						data: data, | 
                                                                                                            
                                                            | 9221 | 9221 |  						language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage, | 
                                                                                                            
                                                            | 9222 | 9222 |  						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */ | 
                                                                                                            
                                                            | 9223 |  | -						placeholder: \'' . dol_escape_js($placeholder) . '\', | 
                                                                                                            
                                                            |  | 9223 | +						placeholder: \'' . dol_escape_js($placeholder).'\', | 
                                                                                                            
                                                            | 9224 | 9224 |  						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                                                                            
                                                            | 9225 |  | -						minimumInputLength: ' . ((int) $minimumInputLength) . ', | 
                                                                                                            
                                                            |  | 9225 | +						minimumInputLength: ' . ((int) $minimumInputLength).', | 
                                                                                                            
                                                            | 9226 | 9226 |  						formatResult: function (result, container, query, escapeMarkup) { | 
                                                                                                            
                                                            | 9227 | 9227 |  							return escapeMarkup(result.text); | 
                                                                                                            
                                                            | 9228 | 9228 |  						}, | 
                                                                                                                                                        
                                                        |  | @@ -9261,11 +9261,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9261 | 9261 |   | 
                                                                                                            
                                                            | 9262 | 9262 |  					' . ($callurlonselect ? ' | 
                                                                                                            
                                                            | 9263 | 9263 |  					/* Code to execute a GET when we select a value */ | 
                                                                                                            
                                                            | 9264 |  | -					$(\'.' . dol_escape_js($htmlname) . '\').change(function() { | 
                                                                                                            
                                                            | 9265 |  | -						var selected = $(\'.' . dol_escape_js($htmlname) . '\').val(); | 
                                                                                                            
                                                            |  | 9264 | +					$(\'.' . dol_escape_js($htmlname).'\').change(function() { | 
                                                                                                            
                                                            |  | 9265 | +						var selected = $(\'.' . dol_escape_js($htmlname).'\').val(); | 
                                                                                                            
                                                            | 9266 | 9266 |  						console.log("We select "+selected) | 
                                                                                                            
                                                            | 9267 | 9267 |   | 
                                                                                                            
                                                            | 9268 |  | -						$(\'.' . dol_escape_js($htmlname) . '\').val("");  /* reset visible combo value */ | 
                                                                                                            
                                                            |  | 9268 | +						$(\'.' . dol_escape_js($htmlname).'\').val("");  /* reset visible combo value */ | 
                                                                                                            
                                                            | 9269 | 9269 |  						$.each( saveRemoteData, function( key, value ) { | 
                                                                                                            
                                                            | 9270 | 9270 |  							if (key == selected) | 
                                                                                                            
                                                            | 9271 | 9271 |  							{ | 
                                                                                                                                                        
                                                        |  | @@ -9273,7 +9273,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9273 | 9273 |  								location.assign(value.url); | 
                                                                                                            
                                                            | 9274 | 9274 |  							} | 
                                                                                                            
                                                            | 9275 | 9275 |  						}); | 
                                                                                                            
                                                            | 9276 |  | -					});' : '') . ' | 
                                                                                                            
                                                            |  | 9276 | +					});' : '').' | 
                                                                                                            
                                                            | 9277 | 9277 |   | 
                                                                                                            
                                                            | 9278 | 9278 |  				}); | 
                                                                                                            
                                                            | 9279 | 9279 |  				</script>'; | 
                                                                                                                                                        
                                                        |  | @@ -9321,7 +9321,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9321 | 9321 |  		$useenhancedmultiselect = 0; | 
                                                                                                            
                                                            | 9322 | 9322 |  		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { | 
                                                                                                            
                                                            | 9323 | 9323 |  			if ($addjscombo) { | 
                                                                                                            
                                                            | 9324 |  | -				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0. | 
                                                                                                            
                                                            |  | 9324 | +				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. | 
                                                                                                            
                                                            | 9325 | 9325 |  			} | 
                                                                                                            
                                                            | 9326 | 9326 |  		} | 
                                                                                                            
                                                            | 9327 | 9327 |   | 
                                                                                                                                                        
                                                        |  | @@ -9330,7 +9330,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9330 | 9330 |  		// submitted to nothing. | 
                                                                                                            
                                                            | 9331 | 9331 |  		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; | 
                                                                                                            
                                                            | 9332 | 9332 |  		// Output select component | 
                                                                                                            
                                                            | 9333 |  | -		$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"; | 
                                                                                                            
                                                            |  | 9333 | +		$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"; | 
                                                                                                            
                                                            | 9334 | 9334 |  		if (is_array($array) && !empty($array)) { | 
                                                                                                            
                                                            | 9335 | 9335 |  			if ($value_as_key) { | 
                                                                                                            
                                                            | 9336 | 9336 |  				$array = array_combine($array, $array); | 
                                                                                                                                                        
                                                        |  | @@ -9351,33 +9351,33 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9351 | 9351 |  						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; | 
                                                                                                            
                                                            | 9352 | 9352 |  					} | 
                                                                                                            
                                                            | 9353 | 9353 |  					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); | 
                                                                                                            
                                                            | 9354 |  | -					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); | 
                                                                                                            
                                                            |  | 9354 | +					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); | 
                                                                                                            
                                                            | 9355 | 9355 |   | 
                                                                                                            
                                                            | 9356 |  | -					$out .= '<option value="' . $tmpkey . '"'; | 
                                                                                                            
                                                            |  | 9356 | +					$out .= '<option value="'.$tmpkey.'"'; | 
                                                                                                            
                                                            | 9357 | 9357 |  					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { | 
                                                                                                            
                                                            | 9358 | 9358 |  						$out .= ' selected'; | 
                                                                                                            
                                                            | 9359 | 9359 |  					} | 
                                                                                                            
                                                            | 9360 | 9360 |  					if (!empty($tmplabelhtml)) { | 
                                                                                                            
                                                            | 9361 |  | -						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; | 
                                                                                                            
                                                            |  | 9361 | +						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; | 
                                                                                                            
                                                            | 9362 | 9362 |  					} else { | 
                                                                                                            
                                                            | 9363 |  | -						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; | 
                                                                                                            
                                                            | 9364 |  | -						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; | 
                                                                                                            
                                                            |  | 9363 | +						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; | 
                                                                                                            
                                                            |  | 9364 | +						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; | 
                                                                                                            
                                                            | 9365 | 9365 |  					} | 
                                                                                                            
                                                            | 9366 | 9366 |  					$out .= '>'; | 
                                                                                                            
                                                            | 9367 | 9367 |  					$out .= dol_htmlentitiesbr($newval); | 
                                                                                                            
                                                            | 9368 |  | -					$out .= '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 9368 | +					$out .= '</option>'."\n"; | 
                                                                                                            
                                                            | 9369 | 9369 |  				} | 
                                                                                                            
                                                            | 9370 | 9370 |  			} | 
                                                                                                            
                                                            | 9371 | 9371 |  		} | 
                                                                                                            
                                                            | 9372 |  | -		$out .= '</select>' . "\n"; | 
                                                                                                            
                                                            |  | 9372 | +		$out .= '</select>'."\n"; | 
                                                                                                            
                                                            | 9373 | 9373 |   | 
                                                                                                            
                                                            | 9374 | 9374 |  		// Add code for jquery to use multiselect | 
                                                                                                            
                                                            | 9375 | 9375 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                                                                            
                                                            | 9376 |  | -			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; | 
                                                                                                            
                                                            | 9377 |  | -			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; | 
                                                                                                            
                                                            |  | 9376 | +			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; | 
                                                                                                            
                                                            |  | 9377 | +			$out .= "\n".'<script nonce="'.getNonce().'">'."\n"; | 
                                                                                                            
                                                            | 9378 | 9378 |  			if ($addjscombo == 1) { | 
                                                                                                            
                                                            | 9379 | 9379 |  				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; | 
                                                                                                            
                                                            | 9380 |  | -				$out .= 'function formatResult(record, container) {' . "\n"; | 
                                                                                                            
                                                            |  | 9380 | +				$out .= 'function formatResult(record, container) {'."\n"; | 
                                                                                                            
                                                            | 9381 | 9381 |  				// If property data-html set, we decode html entities and use this. | 
                                                                                                            
                                                            | 9382 | 9382 |  				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. | 
                                                                                                            
                                                            | 9383 | 9383 |  				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; | 
                                                                                                                                                        
                                                        |  | @@ -9385,26 +9385,26 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9385 | 9385 |  				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));'; | 
                                                                                                            
                                                            | 9386 | 9386 |  				$out .= '	}'."\n"; | 
                                                                                                            
                                                            | 9387 | 9387 |  				$out .= '	return record.text;'; | 
                                                                                                            
                                                            | 9388 |  | -				$out .= '}' . "\n"; | 
                                                                                                            
                                                            | 9389 |  | -				$out .= 'function formatSelection(record) {' . "\n"; | 
                                                                                                            
                                                            |  | 9388 | +				$out .= '}'."\n"; | 
                                                                                                            
                                                            |  | 9389 | +				$out .= 'function formatSelection(record) {'."\n"; | 
                                                                                                            
                                                            | 9390 | 9390 |  				if ($elemtype == 'category') { | 
                                                                                                            
                                                            | 9391 |  | -					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; | 
                                                                                                            
                                                            |  | 9391 | +					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; | 
                                                                                                            
                                                            | 9392 | 9392 |  				} else { | 
                                                                                                            
                                                            | 9393 | 9393 |  					$out .= 'return record.text;'; | 
                                                                                                            
                                                            | 9394 | 9394 |  				} | 
                                                                                                            
                                                            | 9395 |  | -				$out .= '}' . "\n"; | 
                                                                                                            
                                                            |  | 9395 | +				$out .= '}'."\n"; | 
                                                                                                            
                                                            | 9396 | 9396 |  				$out .= '$(document).ready(function () { | 
                                                                                                            
                                                            | 9397 |  | -							$(\'#' . dol_escape_js($htmlname) . '\').' . $tmpplugin . '({'; | 
                                                                                                            
                                                            |  | 9397 | +							$(\'#' . dol_escape_js($htmlname).'\').'.$tmpplugin.'({'; | 
                                                                                                            
                                                            | 9398 | 9398 |  				if ($placeholder) { | 
                                                                                                            
                                                            | 9399 | 9399 |  					$out .= ' | 
                                                                                                            
                                                            | 9400 | 9400 |  								placeholder: { | 
                                                                                                            
                                                            | 9401 | 9401 |  								    id: \'-1\', | 
                                                                                                            
                                                            | 9402 |  | -								    text: \'' . dol_escape_js($placeholder) . '\' | 
                                                                                                            
                                                            |  | 9402 | +								    text: \'' . dol_escape_js($placeholder).'\' | 
                                                                                                            
                                                            | 9403 | 9403 |  								  },'; | 
                                                                                                            
                                                            | 9404 | 9404 |  				} | 
                                                                                                            
                                                            | 9405 | 9405 |  				$out .= '		dir: \'ltr\', | 
                                                                                                            
                                                            | 9406 | 9406 |  								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ | 
                                                                                                            
                                                            | 9407 |  | -								dropdownCssClass: \'' . dol_escape_js($morecss) . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ | 
                                                                                                            
                                                            |  | 9407 | +								dropdownCssClass: \'' . dol_escape_js($morecss).'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ | 
                                                                                                            
                                                            | 9408 | 9408 |  								// Specify format function for dropdown item | 
                                                                                                            
                                                            | 9409 | 9409 |  								formatResult: formatResult, | 
                                                                                                            
                                                            | 9410 | 9410 |  							 	templateResult: formatResult,		/* For 4.0 */ | 
                                                                                                                                                        
                                                        |  | @@ -9417,21 +9417,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9417 | 9417 |   | 
                                                                                                            
                                                            | 9418 | 9418 |  							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set | 
                                                                                                            
                                                            | 9419 | 9419 |  								 the size only if component is not hidden by default on load */ | 
                                                                                                            
                                                            | 9420 |  | -							$(\'#' . dol_escape_js($htmlname) . ' + .select2\').addClass(\'' . dol_escape_js($morecss) . '\'); | 
                                                                                                            
                                                            |  | 9420 | +							$(\'#' . dol_escape_js($htmlname).' + .select2\').addClass(\''.dol_escape_js($morecss).'\'); | 
                                                                                                            
                                                            | 9421 | 9421 |  						});' . "\n"; | 
                                                                                                            
                                                            | 9422 | 9422 |  			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { | 
                                                                                                            
                                                            | 9423 | 9423 |  				// Add other js lib | 
                                                                                                            
                                                            | 9424 | 9424 |  				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin | 
                                                                                                            
                                                            | 9425 | 9425 |  				// ... | 
                                                                                                            
                                                            | 9426 |  | -				$out .= 'console.log(\'addjscombo=2 for htmlname=' . dol_escape_js($htmlname) . '\');'; | 
                                                                                                            
                                                            |  | 9426 | +				$out .= 'console.log(\'addjscombo=2 for htmlname='.dol_escape_js($htmlname).'\');'; | 
                                                                                                            
                                                            | 9427 | 9427 |  				$out .= '$(document).ready(function () { | 
                                                                                                            
                                                            | 9428 |  | -							$(\'#' . dol_escape_js($htmlname) . '\').multiSelect({ | 
                                                                                                            
                                                            |  | 9428 | +							$(\'#' . dol_escape_js($htmlname).'\').multiSelect({ | 
                                                                                                            
                                                            | 9429 | 9429 |  								containerHTML: \'<div class="multi-select-container">\', | 
                                                                                                            
                                                            | 9430 | 9430 |  								menuHTML: \'<div class="multi-select-menu">\', | 
                                                                                                            
                                                            | 9431 |  | -								buttonHTML: \'<span class="multi-select-button ' . dol_escape_js($morecss) . '">\', | 
                                                                                                            
                                                            |  | 9431 | +								buttonHTML: \'<span class="multi-select-button ' . dol_escape_js($morecss).'">\', | 
                                                                                                            
                                                            | 9432 | 9432 |  								menuItemHTML: \'<label class="multi-select-menuitem">\', | 
                                                                                                            
                                                            | 9433 | 9433 |  								activeClass: \'multi-select-container--open\', | 
                                                                                                            
                                                            | 9434 |  | -								noneText: \'' . dol_escape_js($placeholder) . '\' | 
                                                                                                            
                                                            |  | 9434 | +								noneText: \'' . dol_escape_js($placeholder).'\' | 
                                                                                                            
                                                            | 9435 | 9435 |  							}); | 
                                                                                                            
                                                            | 9436 | 9436 |  						})'; | 
                                                                                                            
                                                            | 9437 | 9437 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -9464,7 +9464,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9464 | 9464 |  			return ''; | 
                                                                                                            
                                                            | 9465 | 9465 |  		} | 
                                                                                                            
                                                            | 9466 | 9466 |   | 
                                                                                                            
                                                            | 9467 |  | -		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show | 
                                                                                                            
                                                            |  | 9467 | +		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show | 
                                                                                                            
                                                            | 9468 | 9468 |   | 
                                                                                                            
                                                            | 9469 | 9469 |  		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user | 
                                                                                                            
                                                            | 9470 | 9470 |  			$tmparray = explode(',', $user->conf->$tmpvar); | 
                                                                                                                                                        
                                                        |  | @@ -9507,19 +9507,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9507 | 9507 |  				} | 
                                                                                                            
                                                            | 9508 | 9508 |   | 
                                                                                                            
                                                            | 9509 | 9509 |  				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset | 
                                                                                                            
                                                            | 9510 |  | -				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . ' data-position="'.(empty($val['position']) ? '' : $val['position']).'" /><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; | 
                                                                                                            
                                                            | 9511 |  | -				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); | 
                                                                                                            
                                                            |  | 9510 | +				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').' data-position="'.(empty($val['position']) ? '' : $val['position']).'" /><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; | 
                                                                                                            
                                                            |  | 9511 | +				$listcheckedstring .= (empty($val['checked']) ? '' : $key.','); | 
                                                                                                            
                                                            | 9512 | 9512 |  			} | 
                                                                                                            
                                                            | 9513 | 9513 |  		} | 
                                                                                                            
                                                            | 9514 | 9514 |   | 
                                                                                                            
                                                            | 9515 |  | -		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> | 
                                                                                                            
                                                            |  | 9515 | +		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> | 
                                                                                                            
                                                            | 9516 | 9516 |   | 
                                                                                                            
                                                            | 9517 | 9517 |          <dl class="dropdown"> | 
                                                                                                            
                                                            | 9518 | 9518 |              <dt> | 
                                                                                                            
                                                            | 9519 |  | -            <a href="#' . $htmlname . '"> | 
                                                                                                            
                                                            | 9520 |  | -              ' . img_picto('', 'list') . ' | 
                                                                                                            
                                                            |  | 9519 | +            <a href="#' . $htmlname.'"> | 
                                                                                                            
                                                            |  | 9520 | +              ' . img_picto('', 'list').' | 
                                                                                                            
                                                            | 9521 | 9521 |              </a> | 
                                                                                                            
                                                            | 9522 |  | -            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> | 
                                                                                                            
                                                            |  | 9522 | +            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> | 
                                                                                                            
                                                            | 9523 | 9523 |              </dt> | 
                                                                                                            
                                                            | 9524 | 9524 |              <dd class="dropdowndd"> | 
                                                                                                            
                                                            | 9525 | 9525 |                  <div class="multiselectcheckbox'.$htmlname.'"> | 
                                                                                                                                                        
                                                        |  | @@ -9531,19 +9531,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9531 | 9531 |              </dd> | 
                                                                                                            
                                                            | 9532 | 9532 |          </dl> | 
                                                                                                            
                                                            | 9533 | 9533 |   | 
                                                                                                            
                                                            | 9534 |  | -        <script nonce="' . getNonce() . '" type="text/javascript"> | 
                                                                                                            
                                                            |  | 9534 | +        <script nonce="' . getNonce().'" type="text/javascript"> | 
                                                                                                            
                                                            | 9535 | 9535 |            jQuery(document).ready(function () { | 
                                                                                                            
                                                            | 9536 |  | -              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { | 
                                                                                                            
                                                            |  | 9536 | +              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { | 
                                                                                                            
                                                            | 9537 | 9537 |                    console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); | 
                                                                                                            
                                                            | 9538 | 9538 |   | 
                                                                                                            
                                                            | 9539 | 9539 |                    $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST | 
                                                                                                            
                                                            | 9540 | 9540 |   | 
                                                                                                            
                                                            | 9541 | 9541 |                    var title = $(this).val() + ","; | 
                                                                                                            
                                                            | 9542 | 9542 |                    if ($(this).is(\':checked\')) { | 
                                                                                                            
                                                            | 9543 |  | -                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); | 
                                                                                                            
                                                            |  | 9543 | +                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); | 
                                                                                                            
                                                            | 9544 | 9544 |                    } | 
                                                                                                            
                                                            | 9545 | 9545 |                    else { | 
                                                                                                            
                                                            | 9546 |  | -                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) | 
                                                                                                            
                                                            |  | 9546 | +                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) | 
                                                                                                            
                                                            | 9547 | 9547 |                    } | 
                                                                                                            
                                                            | 9548 | 9548 |                    // Now, we submit page | 
                                                                                                            
                                                            | 9549 | 9549 |                    //$(this).parents(\'form:first\').submit(); | 
                                                                                                                                                        
                                                        |  | @@ -9574,7 +9574,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9574 | 9574 |  	 */ | 
                                                                                                            
                                                            | 9575 | 9575 |  	public function showCategories($id, $type, $rendermode = 0, $nolink = 0) | 
                                                                                                            
                                                            | 9576 | 9576 |  	{ | 
                                                                                                            
                                                            | 9577 |  | -		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; | 
                                                                                                            
                                                            |  | 9577 | +		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; | 
                                                                                                            
                                                            | 9578 | 9578 |   | 
                                                                                                            
                                                            | 9579 | 9579 |  		$cat = new Categorie($this->db); | 
                                                                                                            
                                                            | 9580 | 9580 |  		$categories = $cat->containing($id, $type); | 
                                                                                                                                                        
                                                        |  | @@ -9584,13 +9584,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9584 | 9584 |  			foreach ($categories as $c) { | 
                                                                                                            
                                                            | 9585 | 9585 |  				$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                                                                            
                                                            | 9586 | 9586 |  				foreach ($ways as $way) { | 
                                                                                                            
                                                            | 9587 |  | -					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; | 
                                                                                                            
                                                            |  | 9587 | +					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; | 
                                                                                                            
                                                            | 9588 | 9588 |  				} | 
                                                                                                            
                                                            | 9589 | 9589 |  			} | 
                                                                                                            
                                                            | 9590 | 9590 |  			if (empty($toprint)) { | 
                                                                                                            
                                                            | 9591 | 9591 |  				return ''; | 
                                                                                                            
                                                            | 9592 | 9592 |  			} else { | 
                                                                                                            
                                                            | 9593 |  | -				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                                                                            
                                                            |  | 9593 | +				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                                                                            
                                                            | 9594 | 9594 |  			} | 
                                                                                                            
                                                            | 9595 | 9595 |  		} | 
                                                                                                            
                                                            | 9596 | 9596 |   | 
                                                                                                                                                        
                                                        |  | @@ -9639,15 +9639,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9639 | 9639 |   | 
                                                                                                            
                                                            | 9640 | 9640 |   | 
                                                                                                            
                                                            | 9641 | 9641 |  			print '<div class="div-table-responsive-no-min">'; | 
                                                                                                            
                                                            | 9642 |  | -			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >'; | 
                                                                                                            
                                                            |  | 9642 | +			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >'; | 
                                                                                                            
                                                            | 9643 | 9643 |   | 
                                                                                                            
                                                            | 9644 | 9644 |  			print '<tr class="liste_titre">'; | 
                                                                                                            
                                                            | 9645 |  | -			print '<td>' . $langs->trans("Type") . '</td>'; | 
                                                                                                            
                                                            | 9646 |  | -			print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                                                                            
                                                            |  | 9645 | +			print '<td>'.$langs->trans("Type").'</td>'; | 
                                                                                                            
                                                            |  | 9646 | +			print '<td>'.$langs->trans("Ref").'</td>'; | 
                                                                                                            
                                                            | 9647 | 9647 |  			print '<td class="center"></td>'; | 
                                                                                                            
                                                            | 9648 |  | -			print '<td class="center">' . $langs->trans("Date") . '</td>'; | 
                                                                                                            
                                                            | 9649 |  | -			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                                                                            
                                                            | 9650 |  | -			print '<td class="right">' . $langs->trans("Status") . '</td>'; | 
                                                                                                            
                                                            |  | 9648 | +			print '<td class="center">'.$langs->trans("Date").'</td>'; | 
                                                                                                            
                                                            |  | 9649 | +			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                                                                            
                                                            |  | 9650 | +			print '<td class="right">'.$langs->trans("Status").'</td>'; | 
                                                                                                            
                                                            | 9651 | 9651 |  			print '<td></td>'; | 
                                                                                                            
                                                            | 9652 | 9652 |  			print '</tr>'; | 
                                                                                                            
                                                            | 9653 | 9653 |   | 
                                                                                                                                                        
                                                        |  | @@ -9666,13 +9666,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9666 | 9666 |  				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { | 
                                                                                                            
                                                            | 9667 | 9667 |  					$element = $regs[1]; | 
                                                                                                            
                                                            | 9668 | 9668 |  					$subelement = $regs[2]; | 
                                                                                                            
                                                            | 9669 |  | -					$tplpath = $element . '/' . $subelement; | 
                                                                                                            
                                                            |  | 9669 | +					$tplpath = $element.'/'.$subelement; | 
                                                                                                            
                                                            | 9670 | 9670 |  				} | 
                                                                                                            
                                                            | 9671 | 9671 |  				$tplname = 'linkedobjectblock'; | 
                                                                                                            
                                                            | 9672 | 9672 |   | 
                                                                                                            
                                                            | 9673 | 9673 |  				// To work with non standard path | 
                                                                                                            
                                                            | 9674 | 9674 |  				if ($objecttype == 'facture') { | 
                                                                                                            
                                                            | 9675 |  | -					$tplpath = 'compta/' . $element; | 
                                                                                                            
                                                            |  | 9675 | +					$tplpath = 'compta/'.$element; | 
                                                                                                            
                                                            | 9676 | 9676 |  					if (!isModEnabled('invoice')) { | 
                                                                                                            
                                                            | 9677 | 9677 |  						continue; // Do not show if module disabled | 
                                                                                                            
                                                            | 9678 | 9678 |  					} | 
                                                                                                                                                        
                                                        |  | @@ -9683,7 +9683,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9683 | 9683 |  						continue; // Do not show if module disabled | 
                                                                                                            
                                                            | 9684 | 9684 |  					} | 
                                                                                                            
                                                            | 9685 | 9685 |  				} elseif ($objecttype == 'propal') { | 
                                                                                                            
                                                            | 9686 |  | -					$tplpath = 'comm/' . $element; | 
                                                                                                            
                                                            |  | 9686 | +					$tplpath = 'comm/'.$element; | 
                                                                                                            
                                                            | 9687 | 9687 |  					if (!isModEnabled('propal')) { | 
                                                                                                            
                                                            | 9688 | 9688 |  						continue; // Do not show if module disabled | 
                                                                                                            
                                                            | 9689 | 9689 |  					} | 
                                                                                                                                                        
                                                        |  | @@ -9736,7 +9736,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9736 | 9736 |  				$linkedObjectBlock = $objects; | 
                                                                                                            
                                                            | 9737 | 9737 |   | 
                                                                                                            
                                                            | 9738 | 9738 |  				// Output template part (modules that overwrite templates must declare this into descriptor) | 
                                                                                                            
                                                            | 9739 |  | -				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); | 
                                                                                                            
                                                            |  | 9739 | +				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); | 
                                                                                                            
                                                            | 9740 | 9740 |  				foreach ($dirtpls as $reldir) { | 
                                                                                                            
                                                            | 9741 | 9741 |  					$reldir = rtrim($reldir, '/'); | 
                                                                                                            
                                                            | 9742 | 9742 |  					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after | 
                                                                                                                                                        
                                                        |  | @@ -9744,7 +9744,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9744 | 9744 |  						$noMoreLinkedObjectBlockAfter = 1; | 
                                                                                                            
                                                            | 9745 | 9745 |  					} | 
                                                                                                            
                                                            | 9746 | 9746 |   | 
                                                                                                            
                                                            | 9747 |  | -					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); | 
                                                                                                            
                                                            |  | 9747 | +					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); | 
                                                                                                            
                                                            | 9748 | 9748 |  					if ($res) { | 
                                                                                                            
                                                            | 9749 | 9749 |  						$nboftypesoutput++; | 
                                                                                                            
                                                            | 9750 | 9750 |  						break; | 
                                                                                                                                                        
                                                        |  | @@ -9753,7 +9753,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9753 | 9753 |  			} | 
                                                                                                            
                                                            | 9754 | 9754 |   | 
                                                                                                            
                                                            | 9755 | 9755 |  			if (!$nboftypesoutput) { | 
                                                                                                            
                                                            | 9756 |  | -				print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; | 
                                                                                                            
                                                            |  | 9756 | +				print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; | 
                                                                                                            
                                                            | 9757 | 9757 |  			} | 
                                                                                                            
                                                            | 9758 | 9758 |   | 
                                                                                                            
                                                            | 9759 | 9759 |  			print '</table>'; | 
                                                                                                                                                        
                                                        |  | @@ -9801,14 +9801,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9801 | 9801 |  		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                                                                            
                                                            | 9802 | 9802 |  			$listofidcompanytoscan = (int) $object->thirdparty->id; | 
                                                                                                            
                                                            | 9803 | 9803 |  			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { | 
                                                                                                            
                                                            | 9804 |  | -				$listofidcompanytoscan .= ',' . (int) $object->thirdparty->parent; | 
                                                                                                            
                                                            |  | 9804 | +				$listofidcompanytoscan .= ','.(int) $object->thirdparty->parent; | 
                                                                                                            
                                                            | 9805 | 9805 |  			} | 
                                                                                                            
                                                            | 9806 | 9806 |  			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { | 
                                                                                                            
                                                            | 9807 |  | -				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | 
                                                                                                            
                                                            |  | 9807 | +				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | 
                                                                                                            
                                                            | 9808 | 9808 |  				$tmpproject = new Project($this->db); | 
                                                                                                            
                                                            | 9809 | 9809 |  				$tmpproject->fetch($object->fk_project); | 
                                                                                                            
                                                            | 9810 | 9810 |  				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { | 
                                                                                                            
                                                            | 9811 |  | -					$listofidcompanytoscan .= ',' . (int) $tmpproject->socid; | 
                                                                                                            
                                                            |  | 9811 | +					$listofidcompanytoscan .= ','.(int) $tmpproject->socid; | 
                                                                                                            
                                                            | 9812 | 9812 |  				} | 
                                                                                                            
                                                            | 9813 | 9813 |  				unset($tmpproject); | 
                                                                                                            
                                                            | 9814 | 9814 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -9818,75 +9818,75 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9818 | 9818 |  					'enabled' => isModEnabled('propal'), | 
                                                                                                            
                                                            | 9819 | 9819 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9820 | 9820 |  					'label' => 'LinkToProposal', | 
                                                                                                            
                                                            | 9821 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9821 | +					'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' : ''), | 
                                                                                                            
                                                            | 9822 | 9822 |  				), | 
                                                                                                            
                                                            | 9823 | 9823 |  				'shipping' => array( | 
                                                                                                            
                                                            | 9824 | 9824 |  					'enabled' => isModEnabled('shipping'), | 
                                                                                                            
                                                            | 9825 | 9825 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9826 | 9826 |  					'label' => 'LinkToExpedition', | 
                                                                                                            
                                                            | 9827 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9827 | +					'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' : ''), | 
                                                                                                            
                                                            | 9828 | 9828 |  				), | 
                                                                                                            
                                                            | 9829 | 9829 |  				'order' => array( | 
                                                                                                            
                                                            | 9830 | 9830 |  					'enabled' => isModEnabled('order'), | 
                                                                                                            
                                                            | 9831 | 9831 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9832 | 9832 |  					'label' => 'LinkToOrder', | 
                                                                                                            
                                                            | 9833 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9833 | +					'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' : ''), | 
                                                                                                            
                                                            | 9834 | 9834 |  					'linkname' => 'commande', | 
                                                                                                            
                                                            | 9835 | 9835 |  				), | 
                                                                                                            
                                                            | 9836 | 9836 |  				'invoice' => array( | 
                                                                                                            
                                                            | 9837 | 9837 |  					'enabled' => isModEnabled('invoice'), | 
                                                                                                            
                                                            | 9838 | 9838 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9839 | 9839 |  					'label' => 'LinkToInvoice', | 
                                                                                                            
                                                            | 9840 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9840 | +					'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' : ''), | 
                                                                                                            
                                                            | 9841 | 9841 |  					'linkname' => 'facture', | 
                                                                                                            
                                                            | 9842 | 9842 |  				), | 
                                                                                                            
                                                            | 9843 | 9843 |  				'invoice_template' => array( | 
                                                                                                            
                                                            | 9844 | 9844 |  					'enabled' => isModEnabled('invoice'), | 
                                                                                                            
                                                            | 9845 | 9845 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9846 | 9846 |  					'label' => 'LinkToTemplateInvoice', | 
                                                                                                            
                                                            | 9847 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9847 | +					'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' : ''), | 
                                                                                                            
                                                            | 9848 | 9848 |  				), | 
                                                                                                            
                                                            | 9849 | 9849 |  				'contrat' => array( | 
                                                                                                            
                                                            | 9850 | 9850 |  					'enabled' => isModEnabled('contract'), | 
                                                                                                            
                                                            | 9851 | 9851 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9852 | 9852 |  					'label' => 'LinkToContract', | 
                                                                                                            
                                                            | 9853 | 9853 |  					'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 | 
                                                                                                            
                                                            | 9854 |  | -							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', | 
                                                                                                            
                                                            |  | 9854 | +							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', | 
                                                                                                            
                                                            | 9855 | 9855 |  				), | 
                                                                                                            
                                                            | 9856 | 9856 |  				'fichinter' => array( | 
                                                                                                            
                                                            | 9857 | 9857 |  					'enabled' => isModEnabled('intervention'), | 
                                                                                                            
                                                            | 9858 | 9858 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9859 | 9859 |  					'label' => 'LinkToIntervention', | 
                                                                                                            
                                                            | 9860 |  | -					'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') . ')', | 
                                                                                                            
                                                            |  | 9860 | +					'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').')', | 
                                                                                                            
                                                            | 9861 | 9861 |  				), | 
                                                                                                            
                                                            | 9862 | 9862 |  				'supplier_proposal' => array( | 
                                                                                                            
                                                            | 9863 | 9863 |  					'enabled' => isModEnabled('supplier_proposal'), | 
                                                                                                            
                                                            | 9864 | 9864 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9865 | 9865 |  					'label' => 'LinkToSupplierProposal', | 
                                                                                                            
                                                            | 9866 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9866 | +					'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' : ''), | 
                                                                                                            
                                                            | 9867 | 9867 |  				), | 
                                                                                                            
                                                            | 9868 | 9868 |  				'order_supplier' => array( | 
                                                                                                            
                                                            | 9869 | 9869 |  					'enabled' => isModEnabled("supplier_order"), | 
                                                                                                            
                                                            | 9870 | 9870 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9871 | 9871 |  					'label' => 'LinkToSupplierOrder', | 
                                                                                                            
                                                            | 9872 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9872 | +					'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' : ''), | 
                                                                                                            
                                                            | 9873 | 9873 |  				), | 
                                                                                                            
                                                            | 9874 | 9874 |  				'invoice_supplier' => array( | 
                                                                                                            
                                                            | 9875 | 9875 |  					'enabled' => isModEnabled("supplier_invoice"), | 
                                                                                                            
                                                            | 9876 | 9876 |  					'perms' => 1, 'label' => 'LinkToSupplierInvoice', | 
                                                                                                            
                                                            | 9877 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9877 | +					'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' : ''), | 
                                                                                                            
                                                            | 9878 | 9878 |  				), | 
                                                                                                            
                                                            | 9879 | 9879 |  				'ticket' => array( | 
                                                                                                            
                                                            | 9880 | 9880 |  					'enabled' => isModEnabled('ticket'), | 
                                                                                                            
                                                            | 9881 | 9881 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9882 | 9882 |  					'label' => 'LinkToTicket', | 
                                                                                                            
                                                            | 9883 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9883 | +					'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' : ''), | 
                                                                                                            
                                                            | 9884 | 9884 |  				), | 
                                                                                                            
                                                            | 9885 | 9885 |  				'mo' => array( | 
                                                                                                            
                                                            | 9886 | 9886 |  					'enabled' => isModEnabled('mrp'), | 
                                                                                                            
                                                            | 9887 | 9887 |  					'perms' => 1, | 
                                                                                                            
                                                            | 9888 | 9888 |  					'label' => 'LinkToMo', | 
                                                                                                            
                                                            | 9889 |  | -					'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' : ''), | 
                                                                                                            
                                                            |  | 9889 | +					'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' : ''), | 
                                                                                                            
                                                            | 9890 | 9890 |  				), | 
                                                                                                            
                                                            | 9891 | 9891 |  			); | 
                                                                                                            
                                                            | 9892 | 9892 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -9928,23 +9928,23 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9928 | 9928 |  			} | 
                                                                                                            
                                                            | 9929 | 9929 |   | 
                                                                                                            
                                                            | 9930 | 9930 |  			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { | 
                                                                                                            
                                                            | 9931 |  | -				$htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; | 
                                                                                                            
                                                            |  | 9931 | +				$htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; | 
                                                                                                            
                                                            | 9932 | 9932 |   | 
                                                                                                            
                                                            | 9933 | 9933 |  				// Section for free ref input | 
                                                                                                            
                                                            | 9934 | 9934 |  				if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { | 
                                                                                                            
                                                            | 9935 | 9935 |  					$htmltoenteralink .= '<br>'."\n"; | 
                                                                                                            
                                                            | 9936 | 9936 |  					$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n"; | 
                                                                                                            
                                                            | 9937 |  | -					$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; | 
                                                                                                            
                                                            | 9938 |  | -					$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 9937 | +					$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; | 
                                                                                                            
                                                            |  | 9938 | +					$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 9939 | 9939 |  					$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">'; | 
                                                                                                            
                                                            | 9940 |  | -					$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; | 
                                                                                                            
                                                            | 9941 |  | -					$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; | 
                                                                                                            
                                                            |  | 9940 | +					$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; | 
                                                                                                            
                                                            |  | 9941 | +					$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; | 
                                                                                                            
                                                            | 9942 | 9942 |  					$htmltoenteralink .= '<table class="noborder">'; | 
                                                                                                            
                                                            | 9943 | 9943 |  					$htmltoenteralink .= '<tr class="liste_titre">'; | 
                                                                                                            
                                                            | 9944 | 9944 |  					//print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                                                                            
                                                            | 9945 |  | -					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; | 
                                                                                                            
                                                            | 9946 |  | -					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '"> '; | 
                                                                                                            
                                                            | 9947 |  | -					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; | 
                                                                                                            
                                                            |  | 9945 | +					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; | 
                                                                                                            
                                                            |  | 9946 | +					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans('ToLink').'"> '; | 
                                                                                                            
                                                            |  | 9947 | +					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; | 
                                                                                                            
                                                            | 9948 | 9948 |  					$htmltoenteralink .= '</tr>'; | 
                                                                                                            
                                                            | 9949 | 9949 |  					$htmltoenteralink .= '</table>'; | 
                                                                                                            
                                                            | 9950 | 9950 |  					$htmltoenteralink .= '</form>'; | 
                                                                                                                                                        
                                                        |  | @@ -9963,18 +9963,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9963 | 9963 |  							$htmltoenteralink .= '<br>'; | 
                                                                                                            
                                                            | 9964 | 9964 |  						} | 
                                                                                                            
                                                            | 9965 | 9965 |  						$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n"; | 
                                                                                                            
                                                            | 9966 |  | -						$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; | 
                                                                                                            
                                                            | 9967 |  | -						$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; | 
                                                                                                            
                                                            |  | 9966 | +						$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; | 
                                                                                                            
                                                            |  | 9967 | +						$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; | 
                                                                                                            
                                                            | 9968 | 9968 |  						$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">'; | 
                                                                                                            
                                                            | 9969 |  | -						$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; | 
                                                                                                            
                                                            | 9970 |  | -						$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; | 
                                                                                                            
                                                            |  | 9969 | +						$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; | 
                                                                                                            
                                                            |  | 9970 | +						$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; | 
                                                                                                            
                                                            | 9971 | 9971 |  						$htmltoenteralink .= '<table class="noborder">'; | 
                                                                                                            
                                                            | 9972 | 9972 |  						$htmltoenteralink .= '<tr class="liste_titre">'; | 
                                                                                                            
                                                            | 9973 | 9973 |  						$htmltoenteralink .= '<td class="nowrap"></td>'; | 
                                                                                                            
                                                            | 9974 |  | -						$htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                                                                            
                                                            | 9975 |  | -						$htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>'; | 
                                                                                                            
                                                            | 9976 |  | -						$htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                                                                            
                                                            | 9977 |  | -						$htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>'; | 
                                                                                                            
                                                            |  | 9974 | +						$htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>'; | 
                                                                                                            
                                                            |  | 9975 | +						$htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>'; | 
                                                                                                            
                                                            |  | 9976 | +						$htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                                                                            
                                                            |  | 9977 | +						$htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>'; | 
                                                                                                            
                                                            | 9978 | 9978 |  						$htmltoenteralink .= '</tr>'; | 
                                                                                                            
                                                            | 9979 | 9979 |  						while ($i < $num) { | 
                                                                                                            
                                                            | 9980 | 9980 |  							$objp = $this->db->fetch_object($resqllist); | 
                                                                                                                                                        
                                                        |  | @@ -9989,30 +9989,30 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 9989 | 9989 |  							if ($alreadylinked) { | 
                                                                                                            
                                                            | 9990 | 9990 |  								$htmltoenteralink .= img_picto('', 'link'); | 
                                                                                                            
                                                            | 9991 | 9991 |  							} else { | 
                                                                                                            
                                                            | 9992 |  | -								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; | 
                                                                                                            
                                                            |  | 9992 | +								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; | 
                                                                                                            
                                                            | 9993 | 9993 |  							} | 
                                                                                                            
                                                            | 9994 | 9994 |  							$htmltoenteralink .= '</td>'; | 
                                                                                                            
                                                            | 9995 |  | -							$htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; | 
                                                                                                            
                                                            | 9996 |  | -							$htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; | 
                                                                                                            
                                                            |  | 9995 | +							$htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; | 
                                                                                                            
                                                            |  | 9996 | +							$htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; | 
                                                                                                            
                                                            | 9997 | 9997 |  							$htmltoenteralink .= '<td class="right">'; | 
                                                                                                            
                                                            | 9998 | 9998 |  							if ($possiblelink['label'] == 'LinkToContract') { | 
                                                                                                            
                                                            | 9999 |  | -								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; | 
                                                                                                            
                                                            |  | 9999 | +								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; | 
                                                                                                            
                                                            | 10000 | 10000 |  							} | 
                                                                                                            
                                                            | 10001 |  | -							$htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; | 
                                                                                                            
                                                            |  | 10001 | +							$htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; | 
                                                                                                            
                                                            | 10002 | 10002 |  							$htmltoenteralink .= '</td>'; | 
                                                                                                            
                                                            | 10003 |  | -							$htmltoenteralink .= '<td>' . $objp->name . '</td>'; | 
                                                                                                            
                                                            |  | 10003 | +							$htmltoenteralink .= '<td>'.$objp->name.'</td>'; | 
                                                                                                            
                                                            | 10004 | 10004 |  							$htmltoenteralink .= '</tr>'; | 
                                                                                                            
                                                            | 10005 | 10005 |  							$i++; | 
                                                                                                            
                                                            | 10006 | 10006 |  						} | 
                                                                                                            
                                                            | 10007 | 10007 |  						$htmltoenteralink .= '</table>'; | 
                                                                                                            
                                                            | 10008 | 10008 |  						$htmltoenteralink .= '<div class="center">'; | 
                                                                                                            
                                                            | 10009 | 10009 |  						if ($num) { | 
                                                                                                            
                                                            | 10010 |  | -							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="' . $langs->trans('ToLink') . '">'; | 
                                                                                                            
                                                            |  | 10010 | +							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="'.$langs->trans('ToLink').'">'; | 
                                                                                                            
                                                            | 10011 | 10011 |  						} | 
                                                                                                            
                                                            | 10012 | 10012 |  						if (empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 10013 |  | -							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                                                                            
                                                            |  | 10013 | +							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                                                                            
                                                            | 10014 | 10014 |  						} else { | 
                                                                                                            
                                                            | 10015 |  | -							$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>'; | 
                                                                                                            
                                                            |  | 10015 | +							$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>'; | 
                                                                                                            
                                                            | 10016 | 10016 |  						} | 
                                                                                                            
                                                            | 10017 | 10017 |  						$htmltoenteralink .= '</form>'; | 
                                                                                                            
                                                            | 10018 | 10018 |  					} | 
                                                                                                                                                        
                                                        |  | @@ -10026,10 +10026,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10026 | 10026 |   | 
                                                                                                            
                                                            | 10027 | 10027 |  				// Complete the list for the combo box | 
                                                                                                            
                                                            | 10028 | 10028 |  				if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { | 
                                                                                                            
                                                            | 10029 |  | -					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; | 
                                                                                                            
                                                            |  | 10029 | +					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; | 
                                                                                                            
                                                            | 10030 | 10030 |  					// } else $linktoelem.=$langs->trans($possiblelink['label']); | 
                                                                                                            
                                                            | 10031 | 10031 |  				} else { | 
                                                                                                            
                                                            | 10032 |  | -					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; | 
                                                                                                            
                                                            |  | 10032 | +					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; | 
                                                                                                            
                                                            | 10033 | 10033 |  				} | 
                                                                                                            
                                                            | 10034 | 10034 |  			} | 
                                                                                                            
                                                            | 10035 | 10035 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -10039,11 +10039,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10039 | 10039 |  			<dl class="dropdown" id="linktoobjectname"> | 
                                                                                                            
                                                            | 10040 | 10040 |  			'; | 
                                                                                                            
                                                            | 10041 | 10041 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 10042 |  | -				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; | 
                                                                                                            
                                                            |  | 10042 | +				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; | 
                                                                                                            
                                                            | 10043 | 10043 |  			} | 
                                                                                                            
                                                            | 10044 | 10044 |  			$linktoelem .= '<dd> | 
                                                                                                            
                                                            | 10045 | 10045 |  			<div class="multiselectlinkto"> | 
                                                                                                            
                                                            | 10046 |  | -			<ul class="ulselectedfields">' . $linktoelemlist . ' | 
                                                                                                            
                                                            |  | 10046 | +			<ul class="ulselectedfields">' . $linktoelemlist.' | 
                                                                                                            
                                                            | 10047 | 10047 |  			</ul> | 
                                                                                                            
                                                            | 10048 | 10048 |  			</div> | 
                                                                                                            
                                                            | 10049 | 10049 |  			</dd> | 
                                                                                                                                                        
                                                        |  | @@ -10054,7 +10054,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10054 | 10054 |   | 
                                                                                                            
                                                            | 10055 | 10055 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 10056 | 10056 |  			print '<!-- Add js to show linkto box --> | 
                                                                                                            
                                                            | 10057 |  | -				<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 10057 | +				<script nonce="' . getNonce().'"> | 
                                                                                                            
                                                            | 10058 | 10058 |  				jQuery(document).ready(function() { | 
                                                                                                            
                                                            | 10059 | 10059 |  					jQuery(".linkto").click(function() { | 
                                                                                                            
                                                            | 10060 | 10060 |  						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); | 
                                                                                                                                                        
                                                        |  | @@ -10101,19 +10101,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10101 | 10101 |   | 
                                                                                                            
                                                            | 10102 | 10102 |  		$disabled = ($disabled ? ' disabled' : ''); | 
                                                                                                            
                                                            | 10103 | 10103 |   | 
                                                                                                            
                                                            | 10104 |  | -		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; | 
                                                                                                            
                                                            |  | 10104 | +		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; | 
                                                                                                            
                                                            | 10105 | 10105 |  		if ($useempty) { | 
                                                                                                            
                                                            | 10106 |  | -			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; | 
                                                                                                            
                                                            |  | 10106 | +			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; | 
                                                                                                            
                                                            | 10107 | 10107 |  		} | 
                                                                                                            
                                                            | 10108 | 10108 |  		if (("$value" == 'yes') || ($value == 1)) { | 
                                                                                                            
                                                            | 10109 |  | -			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; | 
                                                                                                            
                                                            | 10110 |  | -			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 10109 | +			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; | 
                                                                                                            
                                                            |  | 10110 | +			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; | 
                                                                                                            
                                                            | 10111 | 10111 |  		} else { | 
                                                                                                            
                                                            | 10112 | 10112 |  			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); | 
                                                                                                            
                                                            | 10113 |  | -			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; | 
                                                                                                            
                                                            | 10114 |  | -			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; | 
                                                                                                            
                                                            |  | 10113 | +			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; | 
                                                                                                            
                                                            |  | 10114 | +			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; | 
                                                                                                            
                                                            | 10115 | 10115 |  		} | 
                                                                                                            
                                                            | 10116 |  | -		$resultyesno .= '</select>' . "\n"; | 
                                                                                                            
                                                            |  | 10116 | +		$resultyesno .= '</select>'."\n"; | 
                                                                                                            
                                                            | 10117 | 10117 |   | 
                                                                                                            
                                                            | 10118 | 10118 |  		if ($addjscombo) { | 
                                                                                                            
                                                            | 10119 | 10119 |  			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); | 
                                                                                                                                                        
                                                        |  | @@ -10137,12 +10137,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10137 | 10137 |  	{ | 
                                                                                                            
                                                            | 10138 | 10138 |  		// phpcs:enable | 
                                                                                                            
                                                            | 10139 | 10139 |  		$sql = "SELECT rowid, label"; | 
                                                                                                            
                                                            | 10140 |  | -		$sql .= " FROM " . $this->db->prefix() . "export_model"; | 
                                                                                                            
                                                            | 10141 |  | -		$sql .= " WHERE type = '" . $this->db->escape($type) . "'"; | 
                                                                                                            
                                                            |  | 10140 | +		$sql .= " FROM ".$this->db->prefix()."export_model"; | 
                                                                                                            
                                                            |  | 10141 | +		$sql .= " WHERE type = '".$this->db->escape($type)."'"; | 
                                                                                                            
                                                            | 10142 | 10142 |  		$sql .= " ORDER BY rowid"; | 
                                                                                                            
                                                            | 10143 | 10143 |  		$result = $this->db->query($sql); | 
                                                                                                            
                                                            | 10144 | 10144 |  		if ($result) { | 
                                                                                                            
                                                            | 10145 |  | -			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 10145 | +			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 10146 | 10146 |  			if ($useempty) { | 
                                                                                                            
                                                            | 10147 | 10147 |  				print '<option value="-1"> </option>'; | 
                                                                                                            
                                                            | 10148 | 10148 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -10152,9 +10152,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10152 | 10152 |  			while ($i < $num) { | 
                                                                                                            
                                                            | 10153 | 10153 |  				$obj = $this->db->fetch_object($result); | 
                                                                                                            
                                                            | 10154 | 10154 |  				if ($selected == $obj->rowid) { | 
                                                                                                            
                                                            | 10155 |  | -					print '<option value="' . $obj->rowid . '" selected>'; | 
                                                                                                            
                                                            |  | 10155 | +					print '<option value="'.$obj->rowid.'" selected>'; | 
                                                                                                            
                                                            | 10156 | 10156 |  				} else { | 
                                                                                                            
                                                            | 10157 |  | -					print '<option value="' . $obj->rowid . '">'; | 
                                                                                                            
                                                            |  | 10157 | +					print '<option value="'.$obj->rowid.'">'; | 
                                                                                                            
                                                            | 10158 | 10158 |  				} | 
                                                                                                            
                                                            | 10159 | 10159 |  				print $obj->label; | 
                                                                                                            
                                                            | 10160 | 10160 |  				print '</option>'; | 
                                                                                                                                                        
                                                        |  | @@ -10253,8 +10253,8 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10253 | 10253 |  				$stringforfirstkey .= ' CTL +'; | 
                                                                                                            
                                                            | 10254 | 10254 |  			} | 
                                                                                                            
                                                            | 10255 | 10255 |   | 
                                                                                                            
                                                            | 10256 |  | -			$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>'; | 
                                                                                                            
                                                            | 10257 |  | -			$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>'; | 
                                                                                                            
                                                            |  | 10256 | +			$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>'; | 
                                                                                                            
                                                            |  | 10257 | +			$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>'; | 
                                                                                                            
                                                            | 10258 | 10258 |  		} | 
                                                                                                            
                                                            | 10259 | 10259 |   | 
                                                                                                            
                                                            | 10260 | 10260 |  		//print "xx".$previous_ref."x".$next_ref; | 
                                                                                                                                                        
                                                        |  | @@ -10262,18 +10262,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10262 | 10262 |   | 
                                                                                                            
                                                            | 10263 | 10263 |  		// Right part of banner | 
                                                                                                            
                                                            | 10264 | 10264 |  		if ($morehtmlright) { | 
                                                                                                            
                                                            | 10265 |  | -			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; | 
                                                                                                            
                                                            |  | 10265 | +			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; | 
                                                                                                            
                                                            | 10266 | 10266 |  		} | 
                                                                                                            
                                                            | 10267 | 10267 |   | 
                                                                                                            
                                                            | 10268 | 10268 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                                                                            
                                                            | 10269 | 10269 |  			$ret .= '<div class="pagination paginationref"><ul class="right">'; | 
                                                                                                            
                                                            | 10270 | 10270 |  		} | 
                                                                                                            
                                                            | 10271 | 10271 |  		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { | 
                                                                                                            
                                                            | 10272 |  | -			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; | 
                                                                                                            
                                                            |  | 10272 | +			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; | 
                                                                                                            
                                                            | 10273 | 10273 |  		} | 
                                                                                                            
                                                            | 10274 | 10274 |  		if ($shownav && ($previous_ref || $next_ref)) { | 
                                                                                                            
                                                            | 10275 |  | -			$ret .= '<li class="pagination">' . $previous_ref . '</li>'; | 
                                                                                                            
                                                            | 10276 |  | -			$ret .= '<li class="pagination">' . $next_ref . '</li>'; | 
                                                                                                            
                                                            |  | 10275 | +			$ret .= '<li class="pagination">'.$previous_ref.'</li>'; | 
                                                                                                            
                                                            |  | 10276 | +			$ret .= '<li class="pagination">'.$next_ref.'</li>'; | 
                                                                                                            
                                                            | 10277 | 10277 |  		} | 
                                                                                                            
                                                            | 10278 | 10278 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                                                                            
                                                            | 10279 | 10279 |  			$ret .= '</ul></div>'; | 
                                                                                                                                                        
                                                        |  | @@ -10288,7 +10288,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10288 | 10288 |  			$morehtmlstatus = $hookmanager->resPrint; | 
                                                                                                            
                                                            | 10289 | 10289 |  		} | 
                                                                                                            
                                                            | 10290 | 10290 |  		if ($morehtmlstatus) { | 
                                                                                                            
                                                            | 10291 |  | -			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; | 
                                                                                                            
                                                            |  | 10291 | +			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; | 
                                                                                                            
                                                            | 10292 | 10292 |  		} | 
                                                                                                            
                                                            | 10293 | 10293 |   | 
                                                                                                            
                                                            | 10294 | 10294 |  		$parameters = array(); | 
                                                                                                                                                        
                                                        |  | @@ -10302,14 +10302,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10302 | 10302 |  		// Left part of banner | 
                                                                                                            
                                                            | 10303 | 10303 |  		if ($morehtmlleft) { | 
                                                                                                            
                                                            | 10304 | 10304 |  			if ($conf->browser->layout == 'phone') { | 
                                                                                                            
                                                            | 10305 |  | -				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; | 
                                                                                                            
                                                            |  | 10305 | +				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; | 
                                                                                                            
                                                            | 10306 | 10306 |  			} else { | 
                                                                                                            
                                                            | 10307 |  | -				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; | 
                                                                                                            
                                                            |  | 10307 | +				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; | 
                                                                                                            
                                                            | 10308 | 10308 |  			} | 
                                                                                                            
                                                            | 10309 | 10309 |  		} | 
                                                                                                            
                                                            | 10310 | 10310 |   | 
                                                                                                            
                                                            | 10311 | 10311 |  		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; | 
                                                                                                            
                                                            | 10312 |  | -		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; | 
                                                                                                            
                                                            |  | 10312 | +		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; | 
                                                                                                            
                                                            | 10313 | 10313 |   | 
                                                                                                            
                                                            | 10314 | 10314 |  		// For thirdparty, contact, user, member, the ref is the id, so we show something else | 
                                                                                                            
                                                            | 10315 | 10315 |  		if ($object->element == 'societe') { | 
                                                                                                                                                        
                                                        |  | @@ -10323,7 +10323,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10323 | 10323 |   | 
                                                                                                            
                                                            | 10324 | 10324 |  			if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                                                                            
                                                            | 10325 | 10325 |  				if (!is_object($extralanguages)) { | 
                                                                                                            
                                                            | 10326 |  | -					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; | 
                                                                                                            
                                                            |  | 10326 | +					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; | 
                                                                                                            
                                                            | 10327 | 10327 |  					$extralanguages = new ExtraLanguages($this->db); | 
                                                                                                            
                                                            | 10328 | 10328 |  				} | 
                                                                                                            
                                                            | 10329 | 10329 |  				$extralanguages->fetch_name_extralanguages('societe'); | 
                                                                                                                                                        
                                                        |  | @@ -10338,21 +10338,21 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10338 | 10338 |  						if ($object->array_languages['name'][$extralangcode]) { | 
                                                                                                            
                                                            | 10339 | 10339 |  							$htmltext .= $object->array_languages['name'][$extralangcode]; | 
                                                                                                            
                                                            | 10340 | 10340 |  						} else { | 
                                                                                                            
                                                            | 10341 |  | -							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; | 
                                                                                                            
                                                            |  | 10341 | +							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; | 
                                                                                                            
                                                            | 10342 | 10342 |  						} | 
                                                                                                            
                                                            | 10343 | 10343 |  					} | 
                                                                                                            
                                                            | 10344 |  | -					$ret .= '<!-- Show translations of name -->' . "\n"; | 
                                                                                                            
                                                            |  | 10344 | +					$ret .= '<!-- Show translations of name -->'."\n"; | 
                                                                                                            
                                                            | 10345 | 10345 |  					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); | 
                                                                                                            
                                                            | 10346 | 10346 |  				} | 
                                                                                                            
                                                            | 10347 | 10347 |  			} | 
                                                                                                            
                                                            | 10348 | 10348 |  		} elseif ($object->element == 'member') { | 
                                                                                                            
                                                            | 10349 | 10349 |  			'@phan-var-force Adherent $object'; | 
                                                                                                            
                                                            | 10350 |  | -			$ret .= $object->ref . '<br>'; | 
                                                                                                            
                                                            |  | 10350 | +			$ret .= $object->ref.'<br>'; | 
                                                                                                            
                                                            | 10351 | 10351 |  			$fullname = $object->getFullName($langs); | 
                                                                                                            
                                                            | 10352 | 10352 |  			if ($object->morphy == 'mor' && $object->societe) { | 
                                                                                                            
                                                            | 10353 |  | -				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); | 
                                                                                                            
                                                            |  | 10353 | +				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); | 
                                                                                                            
                                                            | 10354 | 10354 |  			} else { | 
                                                                                                            
                                                            | 10355 |  | -				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); | 
                                                                                                            
                                                            |  | 10355 | +				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); | 
                                                                                                            
                                                            | 10356 | 10356 |  			} | 
                                                                                                            
                                                            | 10357 | 10357 |  		} elseif (in_array($object->element, array('contact', 'user'))) { | 
                                                                                                            
                                                            | 10358 | 10358 |  			$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt; | 
                                                                                                                                                        
                                                        |  | @@ -10360,7 +10360,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10360 | 10360 |  			$ret .= dol_htmlentities($object->name); | 
                                                                                                            
                                                            | 10361 | 10361 |  		} elseif (in_array($object->element, array('action', 'agenda'))) { | 
                                                                                                            
                                                            | 10362 | 10362 |  			'@phan-var-force ActionComm $object'; | 
                                                                                                            
                                                            | 10363 |  | -			$ret .= $object->ref . '<br>' . $object->label; | 
                                                                                                            
                                                            |  | 10363 | +			$ret .= $object->ref.'<br>'.$object->label; | 
                                                                                                            
                                                            | 10364 | 10364 |  		} elseif (in_array($object->element, array('adherent_type'))) { | 
                                                                                                            
                                                            | 10365 | 10365 |  			$ret .= $object->label; | 
                                                                                                            
                                                            | 10366 | 10366 |  		} elseif ($object->element == 'ecm_directories') { | 
                                                                                                                                                        
                                                        |  | @@ -10413,9 +10413,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10413 | 10413 |  		} | 
                                                                                                            
                                                            | 10414 | 10414 |   | 
                                                                                                            
                                                            | 10415 | 10415 |  		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty | 
                                                                                                            
                                                            | 10416 |  | -		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); | 
                                                                                                            
                                                            | 10417 |  | -		$out = '<!-- url barcode = ' . $url . ' -->'; | 
                                                                                                            
                                                            | 10418 |  | -		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; | 
                                                                                                            
                                                            |  | 10416 | +		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); | 
                                                                                                            
                                                            |  | 10417 | +		$out = '<!-- url barcode = '.$url.' -->'; | 
                                                                                                            
                                                            |  | 10418 | +		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; | 
                                                                                                            
                                                            | 10419 | 10419 |   | 
                                                                                                            
                                                            | 10420 | 10420 |  		return $out; | 
                                                                                                            
                                                            | 10421 | 10421 |  	} | 
                                                                                                                                                        
                                                        |  | @@ -10442,7 +10442,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10442 | 10442 |  		global $conf, $langs; | 
                                                                                                            
                                                            | 10443 | 10443 |   | 
                                                                                                            
                                                            | 10444 | 10444 |  		$entity = (empty($object->entity) ? $conf->entity : $object->entity); | 
                                                                                                            
                                                            | 10445 |  | -		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) | 
                                                                                                            
                                                            |  | 10445 | +		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) | 
                                                                                                            
                                                            | 10446 | 10446 |   | 
                                                                                                            
                                                            | 10447 | 10447 |  		$dir = ''; | 
                                                                                                            
                                                            | 10448 | 10448 |  		$file = ''; | 
                                                                                                                                                        
                                                        |  | @@ -10455,28 +10455,28 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10455 | 10455 |  			if (!empty($object->logo)) { | 
                                                                                                            
                                                            | 10456 | 10456 |  				if (dolIsAllowedForPreview($object->logo)) { | 
                                                                                                            
                                                            | 10457 | 10457 |  					if ((string) $imagesize == 'mini') { | 
                                                                                                            
                                                            | 10458 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs | 
                                                                                                            
                                                            |  | 10458 | +						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs | 
                                                                                                            
                                                            | 10459 | 10459 |  					} elseif ((string) $imagesize == 'small') { | 
                                                                                                            
                                                            | 10460 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); | 
                                                                                                            
                                                            |  | 10460 | +						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); | 
                                                                                                            
                                                            | 10461 | 10461 |  					} else { | 
                                                                                                            
                                                            | 10462 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; | 
                                                                                                            
                                                            |  | 10462 | +						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; | 
                                                                                                            
                                                            | 10463 | 10463 |  					} | 
                                                                                                            
                                                            | 10464 |  | -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; | 
                                                                                                            
                                                            |  | 10464 | +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; | 
                                                                                                            
                                                            | 10465 | 10465 |  				} | 
                                                                                                            
                                                            | 10466 | 10466 |  			} | 
                                                                                                            
                                                            | 10467 | 10467 |  			$email = $object->email; | 
                                                                                                            
                                                            | 10468 | 10468 |  		} elseif ($modulepart == 'contact') { | 
                                                                                                            
                                                            | 10469 |  | -			$dir = $conf->societe->multidir_output[$entity] . '/contact'; | 
                                                                                                            
                                                            |  | 10469 | +			$dir = $conf->societe->multidir_output[$entity].'/contact'; | 
                                                                                                            
                                                            | 10470 | 10470 |  			if (!empty($object->photo)) { | 
                                                                                                            
                                                            | 10471 | 10471 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                                                                            
                                                            | 10472 | 10472 |  					if ((string) $imagesize == 'mini') { | 
                                                                                                            
                                                            | 10473 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); | 
                                                                                                            
                                                            |  | 10473 | +						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); | 
                                                                                                            
                                                            | 10474 | 10474 |  					} elseif ((string) $imagesize == 'small') { | 
                                                                                                            
                                                            | 10475 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); | 
                                                                                                            
                                                            |  | 10475 | +						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); | 
                                                                                                            
                                                            | 10476 | 10476 |  					} else { | 
                                                                                                            
                                                            | 10477 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; | 
                                                                                                            
                                                            |  | 10477 | +						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; | 
                                                                                                            
                                                            | 10478 | 10478 |  					} | 
                                                                                                            
                                                            | 10479 |  | -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; | 
                                                                                                            
                                                            |  | 10479 | +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; | 
                                                                                                            
                                                            | 10480 | 10480 |  				} | 
                                                                                                            
                                                            | 10481 | 10481 |  			} | 
                                                                                                            
                                                            | 10482 | 10482 |  			$email = $object->email; | 
                                                                                                                                                        
                                                        |  | @@ -10486,17 +10486,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10486 | 10486 |  			if (!empty($object->photo)) { | 
                                                                                                            
                                                            | 10487 | 10487 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                                                                            
                                                            | 10488 | 10488 |  					if ((string) $imagesize == 'mini') { | 
                                                                                                            
                                                            | 10489 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); | 
                                                                                                            
                                                            |  | 10489 | +						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); | 
                                                                                                            
                                                            | 10490 | 10490 |  					} elseif ((string) $imagesize == 'small') { | 
                                                                                                            
                                                            | 10491 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); | 
                                                                                                            
                                                            |  | 10491 | +						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); | 
                                                                                                            
                                                            | 10492 | 10492 |  					} else { | 
                                                                                                            
                                                            | 10493 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; | 
                                                                                                            
                                                            |  | 10493 | +						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; | 
                                                                                                            
                                                            | 10494 | 10494 |  					} | 
                                                                                                            
                                                            | 10495 |  | -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; | 
                                                                                                            
                                                            |  | 10495 | +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; | 
                                                                                                            
                                                            | 10496 | 10496 |  				} | 
                                                                                                            
                                                            | 10497 | 10497 |  			} | 
                                                                                                            
                                                            | 10498 | 10498 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                                                                            
                                                            | 10499 |  | -				$altfile = $object->id . ".jpg"; // For backward compatibility | 
                                                                                                            
                                                            |  | 10499 | +				$altfile = $object->id.".jpg"; // For backward compatibility | 
                                                                                                            
                                                            | 10500 | 10500 |  			} | 
                                                                                                            
                                                            | 10501 | 10501 |  			$email = $object->email; | 
                                                                                                            
                                                            | 10502 | 10502 |  			$capture = 'user'; | 
                                                                                                                                                        
                                                        |  | @@ -10505,17 +10505,17 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10505 | 10505 |  			if (!empty($object->photo)) { | 
                                                                                                            
                                                            | 10506 | 10506 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                                                                            
                                                            | 10507 | 10507 |  					if ((string) $imagesize == 'mini') { | 
                                                                                                            
                                                            | 10508 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); | 
                                                                                                            
                                                            |  | 10508 | +						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); | 
                                                                                                            
                                                            | 10509 | 10509 |  					} elseif ((string) $imagesize == 'small') { | 
                                                                                                            
                                                            | 10510 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); | 
                                                                                                            
                                                            |  | 10510 | +						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); | 
                                                                                                            
                                                            | 10511 | 10511 |  					} else { | 
                                                                                                            
                                                            | 10512 |  | -						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; | 
                                                                                                            
                                                            |  | 10512 | +						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; | 
                                                                                                            
                                                            | 10513 | 10513 |  					} | 
                                                                                                            
                                                            | 10514 |  | -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; | 
                                                                                                            
                                                            |  | 10514 | +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; | 
                                                                                                            
                                                            | 10515 | 10515 |  				} | 
                                                                                                            
                                                            | 10516 | 10516 |  			} | 
                                                                                                            
                                                            | 10517 | 10517 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                                                                            
                                                            | 10518 |  | -				$altfile = $object->id . ".jpg"; // For backward compatibility | 
                                                                                                            
                                                            |  | 10518 | +				$altfile = $object->id.".jpg"; // For backward compatibility | 
                                                                                                            
                                                            | 10519 | 10519 |  			} | 
                                                                                                            
                                                            | 10520 | 10520 |  			$email = $object->email; | 
                                                                                                            
                                                            | 10521 | 10521 |  			$capture = 'user'; | 
                                                                                                                                                        
                                                        |  | @@ -10541,35 +10541,35 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10541 | 10541 |  		$ret = ''; | 
                                                                                                            
                                                            | 10542 | 10542 |   | 
                                                                                                            
                                                            | 10543 | 10543 |  		if ($dir) { | 
                                                                                                            
                                                            | 10544 |  | -			if ($file && file_exists($dir . "/" . $file)) { | 
                                                                                                            
                                                            |  | 10544 | +			if ($file && file_exists($dir."/".$file)) { | 
                                                                                                            
                                                            | 10545 | 10545 |  				if ($addlinktofullsize) { | 
                                                                                                            
                                                            | 10546 |  | -					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); | 
                                                                                                            
                                                            |  | 10546 | +					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); | 
                                                                                                            
                                                            | 10547 | 10547 |  					if ($urladvanced) { | 
                                                                                                            
                                                            | 10548 |  | -						$ret .= '<a href="' . $urladvanced . '">'; | 
                                                                                                            
                                                            |  | 10548 | +						$ret .= '<a href="'.$urladvanced.'">'; | 
                                                                                                            
                                                            | 10549 | 10549 |  					} else { | 
                                                                                                            
                                                            | 10550 |  | -						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; | 
                                                                                                            
                                                            |  | 10550 | +						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; | 
                                                                                                            
                                                            | 10551 | 10551 |  					} | 
                                                                                                            
                                                            | 10552 | 10552 |  				} | 
                                                                                                            
                                                            | 10553 |  | -				$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 . '">'; | 
                                                                                                            
                                                            |  | 10553 | +				$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.'">'; | 
                                                                                                            
                                                            | 10554 | 10554 |  				if ($addlinktofullsize) { | 
                                                                                                            
                                                            | 10555 | 10555 |  					$ret .= '</a>'; | 
                                                                                                            
                                                            | 10556 | 10556 |  				} | 
                                                                                                            
                                                            | 10557 |  | -			} elseif ($altfile && file_exists($dir . "/" . $altfile)) { | 
                                                                                                            
                                                            |  | 10557 | +			} elseif ($altfile && file_exists($dir."/".$altfile)) { | 
                                                                                                            
                                                            | 10558 | 10558 |  				if ($addlinktofullsize) { | 
                                                                                                            
                                                            | 10559 |  | -					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); | 
                                                                                                            
                                                            |  | 10559 | +					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); | 
                                                                                                            
                                                            | 10560 | 10560 |  					if ($urladvanced) { | 
                                                                                                            
                                                            | 10561 |  | -						$ret .= '<a href="' . $urladvanced . '">'; | 
                                                                                                            
                                                            |  | 10561 | +						$ret .= '<a href="'.$urladvanced.'">'; | 
                                                                                                            
                                                            | 10562 | 10562 |  					} else { | 
                                                                                                            
                                                            | 10563 |  | -						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; | 
                                                                                                            
                                                            |  | 10563 | +						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; | 
                                                                                                            
                                                            | 10564 | 10564 |  					} | 
                                                                                                            
                                                            | 10565 | 10565 |  				} | 
                                                                                                            
                                                            | 10566 |  | -				$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 . '">'; | 
                                                                                                            
                                                            |  | 10566 | +				$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.'">'; | 
                                                                                                            
                                                            | 10567 | 10567 |  				if ($addlinktofullsize) { | 
                                                                                                            
                                                            | 10568 | 10568 |  					$ret .= '</a>'; | 
                                                                                                            
                                                            | 10569 | 10569 |  				} | 
                                                                                                            
                                                            | 10570 | 10570 |  			} else { | 
                                                                                                            
                                                            | 10571 | 10571 |  				$nophoto = '/public/theme/common/nophoto.png'; | 
                                                                                                            
                                                            | 10572 |  | -				$defaultimg = 'identicon';        // For gravatar | 
                                                                                                            
                                                            |  | 10572 | +				$defaultimg = 'identicon'; // For gravatar | 
                                                                                                            
                                                            | 10573 | 10573 |  				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found | 
                                                                                                            
                                                            | 10574 | 10574 |  					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { | 
                                                                                                            
                                                            | 10575 | 10575 |  						$nophoto = 'company'; | 
                                                                                                                                                        
                                                        |  | @@ -10587,13 +10587,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10587 | 10587 |  				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { | 
                                                                                                            
                                                            | 10588 | 10588 |  					// see https://gravatar.com/site/implement/images/php/ | 
                                                                                                            
                                                            | 10589 | 10589 |  					$ret .= '<!-- Put link to gravatar -->'; | 
                                                                                                            
                                                            | 10590 |  | -					$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 | 
                                                                                                            
                                                            |  | 10590 | +					$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 | 
                                                                                                            
                                                            | 10591 | 10591 |  				} else { | 
                                                                                                            
                                                            | 10592 | 10592 |  					if ($nophoto == 'company') { | 
                                                                                                            
                                                            | 10593 |  | -						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; | 
                                                                                                            
                                                            |  | 10593 | +						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; | 
                                                                                                            
                                                            | 10594 | 10594 |  						//$ret .= '<div class="difforspanimgright"></div>'; | 
                                                                                                            
                                                            | 10595 | 10595 |  					} else { | 
                                                                                                            
                                                            | 10596 |  | -						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; | 
                                                                                                            
                                                            |  | 10596 | +						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; | 
                                                                                                            
                                                            | 10597 | 10597 |  					} | 
                                                                                                            
                                                            | 10598 | 10598 |  				} | 
                                                                                                            
                                                            | 10599 | 10599 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -10604,15 +10604,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10604 | 10604 |  				} | 
                                                                                                            
                                                            | 10605 | 10605 |  				$ret .= '<table class="nobordernopadding centpercent">'; | 
                                                                                                            
                                                            | 10606 | 10606 |  				if ($object->photo) { | 
                                                                                                            
                                                            | 10607 |  | -					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; | 
                                                                                                            
                                                            |  | 10607 | +					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; | 
                                                                                                            
                                                            | 10608 | 10608 |  				} | 
                                                                                                            
                                                            | 10609 | 10609 |  				$ret .= '<tr><td class="tdoverflow">'; | 
                                                                                                            
                                                            | 10610 | 10610 |  				$maxfilesizearray = getMaxFileSizeArray(); | 
                                                                                                            
                                                            | 10611 | 10611 |  				$maxmin = $maxfilesizearray['maxmin']; | 
                                                                                                            
                                                            | 10612 | 10612 |  				if ($maxmin > 0) { | 
                                                                                                            
                                                            | 10613 |  | -					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file | 
                                                                                                            
                                                            |  | 10613 | +					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file | 
                                                                                                            
                                                            | 10614 | 10614 |  				} | 
                                                                                                            
                                                            | 10615 |  | -				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; | 
                                                                                                            
                                                            |  | 10615 | +				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; | 
                                                                                                            
                                                            | 10616 | 10616 |  				$ret .= '</td></tr>'; | 
                                                                                                            
                                                            | 10617 | 10617 |  				$ret .= '</table>'; | 
                                                                                                            
                                                            | 10618 | 10618 |  			} | 
                                                                                                                                                        
                                                        |  | @@ -10666,38 +10666,38 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10666 | 10666 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                                                                            
                                                            | 10667 | 10667 |  			$sql .= ", e.label"; | 
                                                                                                            
                                                            | 10668 | 10668 |  		} | 
                                                                                                            
                                                            | 10669 |  | -		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; | 
                                                                                                            
                                                            |  | 10669 | +		$sql .= " FROM ".$this->db->prefix()."usergroup as ug "; | 
                                                                                                            
                                                            | 10670 | 10670 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                                                                            
                                                            | 10671 |  | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; | 
                                                                                                            
                                                            |  | 10671 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; | 
                                                                                                            
                                                            | 10672 | 10672 |  			if ($force_entity) { | 
                                                                                                            
                                                            | 10673 |  | -				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; | 
                                                                                                            
                                                            |  | 10673 | +				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; | 
                                                                                                            
                                                            | 10674 | 10674 |  			} else { | 
                                                                                                            
                                                            | 10675 | 10675 |  				$sql .= " WHERE ug.entity IS NOT NULL"; | 
                                                                                                            
                                                            | 10676 | 10676 |  			} | 
                                                                                                            
                                                            | 10677 | 10677 |  		} else { | 
                                                                                                            
                                                            | 10678 |  | -			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; | 
                                                                                                            
                                                            |  | 10678 | +			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; | 
                                                                                                            
                                                            | 10679 | 10679 |  		} | 
                                                                                                            
                                                            | 10680 | 10680 |  		if (is_array($exclude) && $excludeGroups) { | 
                                                                                                            
                                                            | 10681 |  | -			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; | 
                                                                                                            
                                                            |  | 10681 | +			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; | 
                                                                                                            
                                                            | 10682 | 10682 |  		} | 
                                                                                                            
                                                            | 10683 | 10683 |  		if (is_array($include) && $includeGroups) { | 
                                                                                                            
                                                            | 10684 |  | -			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; | 
                                                                                                            
                                                            |  | 10684 | +			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; | 
                                                                                                            
                                                            | 10685 | 10685 |  		} | 
                                                                                                            
                                                            | 10686 | 10686 |  		$sql .= " ORDER BY ug.nom ASC"; | 
                                                                                                            
                                                            | 10687 | 10687 |   | 
                                                                                                            
                                                            | 10688 |  | -		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); | 
                                                                                                            
                                                            |  | 10688 | +		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); | 
                                                                                                            
                                                            | 10689 | 10689 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 10690 | 10690 |  		if ($resql) { | 
                                                                                                            
                                                            | 10691 | 10691 |  			// Enhance with select2 | 
                                                                                                            
                                                            | 10692 |  | -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 10692 | +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 10693 | 10693 |   | 
                                                                                                            
                                                            | 10694 |  | -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; | 
                                                                                                            
                                                            |  | 10694 | +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; | 
                                                                                                            
                                                            | 10695 | 10695 |   | 
                                                                                                            
                                                            | 10696 | 10696 |  			$num = $this->db->num_rows($resql); | 
                                                                                                            
                                                            | 10697 | 10697 |  			$i = 0; | 
                                                                                                            
                                                            | 10698 | 10698 |  			if ($num) { | 
                                                                                                            
                                                            | 10699 | 10699 |  				if ($show_empty && !$multiple) { | 
                                                                                                            
                                                            | 10700 |  | -					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; | 
                                                                                                            
                                                            |  | 10700 | +					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; | 
                                                                                                            
                                                            | 10701 | 10701 |  				} | 
                                                                                                            
                                                            | 10702 | 10702 |   | 
                                                                                                            
                                                            | 10703 | 10703 |  				while ($i < $num) { | 
                                                                                                                                                        
                                                        |  | @@ -10710,11 +10710,11 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10710 | 10710 |  					$label = $obj->name; | 
                                                                                                            
                                                            | 10711 | 10711 |  					$labelhtml = $obj->name; | 
                                                                                                            
                                                            | 10712 | 10712 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { | 
                                                                                                            
                                                            | 10713 |  | -						$label .= " (" . $obj->label . ")"; | 
                                                                                                            
                                                            | 10714 |  | -						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; | 
                                                                                                            
                                                            |  | 10713 | +						$label .= " (".$obj->label.")"; | 
                                                                                                            
                                                            |  | 10714 | +						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; | 
                                                                                                            
                                                            | 10715 | 10715 |  					} | 
                                                                                                            
                                                            | 10716 | 10716 |   | 
                                                                                                            
                                                            | 10717 |  | -					$out .= '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 10717 | +					$out .= '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 10718 | 10718 |  					if ($disableline) { | 
                                                                                                            
                                                            | 10719 | 10719 |  						$out .= ' disabled'; | 
                                                                                                            
                                                            | 10720 | 10720 |  					} | 
                                                                                                                                                        
                                                        |  | @@ -10730,9 +10730,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10730 | 10730 |  				} | 
                                                                                                            
                                                            | 10731 | 10731 |  			} else { | 
                                                                                                            
                                                            | 10732 | 10732 |  				if ($show_empty) { | 
                                                                                                            
                                                            | 10733 |  | -					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; | 
                                                                                                            
                                                            |  | 10733 | +					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; | 
                                                                                                            
                                                            | 10734 | 10734 |  				} | 
                                                                                                            
                                                            | 10735 |  | -				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; | 
                                                                                                            
                                                            |  | 10735 | +				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; | 
                                                                                                            
                                                            | 10736 | 10736 |  			} | 
                                                                                                            
                                                            | 10737 | 10737 |  			$out .= '</select>'; | 
                                                                                                            
                                                            | 10738 | 10738 |   | 
                                                                                                                                                        
                                                        |  | @@ -10776,25 +10776,25 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10776 | 10776 |  		$out = ''; | 
                                                                                                            
                                                            | 10777 | 10777 |   | 
                                                                                                            
                                                            | 10778 | 10778 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 10779 |  | -			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; | 
                                                                                                            
                                                            |  | 10779 | +			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; | 
                                                                                                            
                                                            | 10780 | 10780 |  		} | 
                                                                                                            
                                                            | 10781 |  | -		$out .= '<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 10781 | +		$out .= '<script nonce="'.getNonce().'"> | 
                                                                                                            
                                                            | 10782 | 10782 |              $(document).ready(function() { | 
                                                                                                            
                                                            | 10783 |  | -                $("#' . $cssclass . 's").click(function() { | 
                                                                                                            
                                                            |  | 10783 | +                $("#' . $cssclass.'s").click(function() { | 
                                                                                                            
                                                            | 10784 | 10784 |                      if($(this).is(\':checked\')){ | 
                                                                                                            
                                                            | 10785 |  | -                        console.log("We check all ' . $cssclass . ' and trigger the change method"); | 
                                                                                                            
                                                            | 10786 |  | -                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); | 
                                                                                                            
                                                            |  | 10785 | +                        console.log("We check all ' . $cssclass.' and trigger the change method"); | 
                                                                                                            
                                                            |  | 10786 | +                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); | 
                                                                                                            
                                                            | 10787 | 10787 |                      } | 
                                                                                                            
                                                            | 10788 | 10788 |                      else | 
                                                                                                            
                                                            | 10789 | 10789 |                      { | 
                                                                                                            
                                                            | 10790 | 10790 |                          console.log("We uncheck all"); | 
                                                                                                            
                                                            | 10791 |  | -                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); | 
                                                                                                            
                                                            |  | 10791 | +                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); | 
                                                                                                            
                                                            | 10792 | 10792 |                      }' . "\n"; | 
                                                                                                            
                                                            | 10793 | 10793 |  		if ($calljsfunction) { | 
                                                                                                            
                                                            | 10794 |  | -			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                                                                            
                                                            |  | 10794 | +			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                                                                            
                                                            | 10795 | 10795 |  		} | 
                                                                                                            
                                                            | 10796 | 10796 |  		$out .= '         }); | 
                                                                                                            
                                                            | 10797 |  | -        	        $(".' . $cssclass . '").change(function() { | 
                                                                                                            
                                                            |  | 10797 | +        	        $(".' . $cssclass.'").change(function() { | 
                                                                                                            
                                                            | 10798 | 10798 |  					$(this).closest("tr").toggleClass("highlight", this.checked); | 
                                                                                                            
                                                            | 10799 | 10799 |  				}); | 
                                                                                                            
                                                            | 10800 | 10800 |  		 	}); | 
                                                                                                                                                        
                                                        |  | @@ -10839,67 +10839,67 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10839 | 10839 |  		global $langs, $user; | 
                                                                                                            
                                                            | 10840 | 10840 |   | 
                                                                                                            
                                                            | 10841 | 10841 |  		$out = ''; | 
                                                                                                            
                                                            | 10842 |  | -		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; | 
                                                                                                            
                                                            | 10843 |  | -		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; | 
                                                                                                            
                                                            |  | 10842 | +		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; | 
                                                                                                            
                                                            |  | 10843 | +		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; | 
                                                                                                            
                                                            | 10844 | 10844 |  		if (!empty($excludeid)) { | 
                                                                                                            
                                                            | 10845 |  | -			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; | 
                                                                                                            
                                                            |  | 10845 | +			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; | 
                                                                                                            
                                                            | 10846 | 10846 |  		} | 
                                                                                                            
                                                            | 10847 | 10847 |  		$sql .= " ORDER BY label"; | 
                                                                                                            
                                                            | 10848 | 10848 |   | 
                                                                                                            
                                                            | 10849 | 10849 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 10850 | 10850 |  		if ($resql) { | 
                                                                                                            
                                                            | 10851 |  | -			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; | 
                                                                                                            
                                                            |  | 10851 | +			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; | 
                                                                                                            
                                                            | 10852 | 10852 |  			if ($useempty) { | 
                                                                                                            
                                                            | 10853 | 10853 |  				$out .= '<option value="0"> </option>'; | 
                                                                                                            
                                                            | 10854 | 10854 |  			} | 
                                                                                                            
                                                            | 10855 | 10855 |   | 
                                                                                                            
                                                            | 10856 | 10856 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                                                                            
                                                            | 10857 |  | -				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; | 
                                                                                                            
                                                            |  | 10857 | +				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; | 
                                                                                                            
                                                            | 10858 | 10858 |  			} | 
                                                                                                            
                                                            | 10859 | 10859 |  			$out .= '</select>'; | 
                                                                                                            
                                                            | 10860 |  | -			$out .= ajax_combobox('select_' . $htmlname); | 
                                                                                                            
                                                            |  | 10860 | +			$out .= ajax_combobox('select_'.$htmlname); | 
                                                                                                            
                                                            | 10861 | 10861 |   | 
                                                                                                            
                                                            | 10862 | 10862 |  			if (!empty($htmlname) && $user->admin && $info_admin) { | 
                                                                                                            
                                                            | 10863 |  | -				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                                                                            
                                                            |  | 10863 | +				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                                                                            
                                                            | 10864 | 10864 |  			} | 
                                                                                                            
                                                            | 10865 | 10865 |   | 
                                                                                                            
                                                            | 10866 | 10866 |  			if (!empty($target)) { | 
                                                                                                            
                                                            | 10867 |  | -				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; | 
                                                                                                            
                                                            |  | 10867 | +				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; | 
                                                                                                            
                                                            | 10868 | 10868 |  				$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 10869 | 10869 |  				if ($resql) { | 
                                                                                                            
                                                            | 10870 | 10870 |  					if ($this->db->num_rows($resql) > 0) { | 
                                                                                                            
                                                            | 10871 | 10871 |  						$obj = $this->db->fetch_object($resql); | 
                                                                                                            
                                                            | 10872 |  | -						$out .= '<script nonce="' . getNonce() . '"> | 
                                                                                                            
                                                            |  | 10872 | +						$out .= '<script nonce="'.getNonce().'"> | 
                                                                                                            
                                                            | 10873 | 10873 |  							$(function() { | 
                                                                                                            
                                                            | 10874 |  | -								$("select[name=' . $target . ']").on("change", function() { | 
                                                                                                            
                                                            |  | 10874 | +								$("select[name=' . $target.']").on("change", function() { | 
                                                                                                            
                                                            | 10875 | 10875 |  									var current_val = $(this).val(); | 
                                                                                                            
                                                            | 10876 |  | -									if (current_val == ' . $obj->id . ') {'; | 
                                                                                                            
                                                            |  | 10876 | +									if (current_val == ' . $obj->id.') {'; | 
                                                                                                            
                                                            | 10877 | 10877 |  						if (!empty($default_selected) || !empty($selected)) { | 
                                                                                                            
                                                            | 10878 |  | -							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; | 
                                                                                                            
                                                            |  | 10878 | +							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; | 
                                                                                                            
                                                            | 10879 | 10879 |  						} | 
                                                                                                            
                                                            | 10880 | 10880 |   | 
                                                                                                            
                                                            | 10881 | 10881 |  						$out .= ' | 
                                                                                                            
                                                            | 10882 |  | -										$("select[name=' . $htmlname . ']").change(); | 
                                                                                                            
                                                            |  | 10882 | +										$("select[name=' . $htmlname.']").change(); | 
                                                                                                            
                                                            | 10883 | 10883 |  									} | 
                                                                                                            
                                                            | 10884 | 10884 |  								}); | 
                                                                                                            
                                                            | 10885 | 10885 |   | 
                                                                                                            
                                                            | 10886 |  | -								$("select[name=' . $htmlname . ']").change(function() { | 
                                                                                                            
                                                            |  | 10886 | +								$("select[name=' . $htmlname.']").change(function() { | 
                                                                                                            
                                                            | 10887 | 10887 |   | 
                                                                                                            
                                                            | 10888 |  | -									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { | 
                                                                                                            
                                                            |  | 10888 | +									if ($("select[name=' . $target.']").val() == '.$obj->id.') { | 
                                                                                                            
                                                            | 10889 | 10889 |  										// get price of kilometer to fill the unit price | 
                                                                                                            
                                                            | 10890 | 10890 |  										$.ajax({ | 
                                                                                                            
                                                            | 10891 | 10891 |  											method: "POST", | 
                                                                                                            
                                                            | 10892 | 10892 |  											dataType: "json", | 
                                                                                                            
                                                            | 10893 |  | -											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, | 
                                                                                                            
                                                            | 10894 |  | -											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", | 
                                                                                                            
                                                            |  | 10893 | +											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, | 
                                                                                                            
                                                            |  | 10894 | +											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", | 
                                                                                                            
                                                            | 10895 | 10895 |  										}).done(function( data, textStatus, jqXHR ) { | 
                                                                                                            
                                                            | 10896 | 10896 |  											console.log(data); | 
                                                                                                            
                                                            | 10897 | 10897 |  											if (typeof data.up != "undefined") { | 
                                                                                                            
                                                            | 10898 | 10898 |  												$("input[name=value_unit]").val(data.up); | 
                                                                                                            
                                                            | 10899 |  | -												$("select[name=' . $htmlname . ']").attr("title", data.title); | 
                                                                                                            
                                                            |  | 10899 | +												$("select[name=' . $htmlname.']").attr("title", data.title); | 
                                                                                                            
                                                            | 10900 | 10900 |  											} else { | 
                                                                                                            
                                                            | 10901 | 10901 |  												$("input[name=value_unit]").val(""); | 
                                                                                                            
                                                            | 10902 |  | -												$("select[name=' . $htmlname . ']").attr("title", ""); | 
                                                                                                            
                                                            |  | 10902 | +												$("select[name=' . $htmlname.']").attr("title", ""); | 
                                                                                                            
                                                            | 10903 | 10903 |  											} | 
                                                                                                            
                                                            | 10904 | 10904 |  										}); | 
                                                                                                            
                                                            | 10905 | 10905 |  									} | 
                                                                                                                                                        
                                                        |  | @@ -10929,18 +10929,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10929 | 10929 |  		global $conf, $langs; | 
                                                                                                            
                                                            | 10930 | 10930 |   | 
                                                                                                            
                                                            | 10931 | 10931 |  		$out = ''; | 
                                                                                                            
                                                            | 10932 |  | -		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; | 
                                                                                                            
                                                            | 10933 |  | -		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; | 
                                                                                                            
                                                            |  | 10932 | +		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; | 
                                                                                                            
                                                            |  | 10933 | +		$sql .= " WHERE entity = ".$conf->entity." AND active = 1"; | 
                                                                                                            
                                                            | 10934 | 10934 |   | 
                                                                                                            
                                                            | 10935 | 10935 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 10936 | 10936 |  		if ($resql) { | 
                                                                                                            
                                                            | 10937 |  | -			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; | 
                                                                                                            
                                                            |  | 10937 | +			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; | 
                                                                                                            
                                                            | 10938 | 10938 |  			if ($useempty) { | 
                                                                                                            
                                                            | 10939 | 10939 |  				$out .= '<option value="0"></option>'; | 
                                                                                                            
                                                            | 10940 | 10940 |  			} | 
                                                                                                            
                                                            | 10941 | 10941 |   | 
                                                                                                            
                                                            | 10942 | 10942 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                                                                            
                                                            | 10943 |  | -				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; | 
                                                                                                            
                                                            |  | 10943 | +				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; | 
                                                                                                            
                                                            | 10944 | 10944 |  			} | 
                                                                                                            
                                                            | 10945 | 10945 |  			$out .= '</select>'; | 
                                                                                                            
                                                            | 10946 | 10946 |  		} else { | 
                                                                                                                                                        
                                                        |  | @@ -10971,12 +10971,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10971 | 10971 |   | 
                                                                                                            
                                                            | 10972 | 10972 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 10973 | 10973 |  		if ($resql) { | 
                                                                                                            
                                                            | 10974 |  | -			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; | 
                                                                                                            
                                                            |  | 10974 | +			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; | 
                                                                                                            
                                                            | 10975 | 10975 |  			if ($useempty) { | 
                                                                                                            
                                                            | 10976 | 10976 |  				$out .= '<option value="0"></option>'; | 
                                                                                                            
                                                            | 10977 | 10977 |  			} | 
                                                                                                            
                                                            | 10978 | 10978 |  			if ($allchoice) { | 
                                                                                                            
                                                            | 10979 |  | -				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; | 
                                                                                                            
                                                            |  | 10979 | +				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; | 
                                                                                                            
                                                            | 10980 | 10980 |  			} | 
                                                                                                            
                                                            | 10981 | 10981 |   | 
                                                                                                            
                                                            | 10982 | 10982 |  			$field = 'code'; | 
                                                                                                                                                        
                                                        |  | @@ -10986,7 +10986,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 10986 | 10986 |   | 
                                                                                                            
                                                            | 10987 | 10987 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                                                                            
                                                            | 10988 | 10988 |  				$key = $langs->trans($obj->code); | 
                                                                                                            
                                                            | 10989 |  | -				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; | 
                                                                                                            
                                                            |  | 10989 | +				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; | 
                                                                                                            
                                                            | 10990 | 10990 |  			} | 
                                                                                                            
                                                            | 10991 | 10991 |  			$out .= '</select>'; | 
                                                                                                            
                                                            | 10992 | 10992 |   | 
                                                                                                                                                        
                                                        |  | @@ -11020,7 +11020,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11020 | 11020 |  	{ | 
                                                                                                            
                                                            | 11021 | 11021 |  		global $user, $conf, $langs; | 
                                                                                                            
                                                            | 11022 | 11022 |   | 
                                                                                                            
                                                            | 11023 |  | -		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | 
                                                                                                            
                                                            |  | 11023 | +		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | 
                                                                                                            
                                                            | 11024 | 11024 |   | 
                                                                                                            
                                                            | 11025 | 11025 |  		if (is_null($usertofilter)) { | 
                                                                                                            
                                                            | 11026 | 11026 |  			$usertofilter = $user; | 
                                                                                                                                                        
                                                        |  | @@ -11044,10 +11044,10 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11044 | 11044 |  		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, | 
                                                                                                            
                                                            | 11045 | 11045 |              p.title, p.fk_soc, p.fk_statut, p.public,"; | 
                                                                                                            
                                                            | 11046 | 11046 |  		$sql .= ' s.nom as name'; | 
                                                                                                            
                                                            | 11047 |  | -		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; | 
                                                                                                            
                                                            | 11048 |  | -		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; | 
                                                                                                            
                                                            | 11049 |  | -		$sql .= ' ' . $this->db->prefix() . 'facture as f'; | 
                                                                                                            
                                                            | 11050 |  | -		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; | 
                                                                                                            
                                                            |  | 11047 | +		$sql .= ' FROM '.$this->db->prefix().'projet as p'; | 
                                                                                                            
                                                            |  | 11048 | +		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; | 
                                                                                                            
                                                            |  | 11049 | +		$sql .= ' '.$this->db->prefix().'facture as f'; | 
                                                                                                            
                                                            |  | 11050 | +		$sql .= " WHERE p.entity IN (".getEntity('project').")"; | 
                                                                                                            
                                                            | 11051 | 11051 |  		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement | 
                                                                                                            
                                                            | 11052 | 11052 |  		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; | 
                                                                                                            
                                                            | 11053 | 11053 |  		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; | 
                                                                                                                                                        
                                                        |  | @@ -11058,14 +11058,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11058 | 11058 |  		if ($resql) { | 
                                                                                                            
                                                            | 11059 | 11059 |  			// Use select2 selector | 
                                                                                                            
                                                            | 11060 | 11060 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 11061 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 11061 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 11062 | 11062 |  				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); | 
                                                                                                            
                                                            | 11063 | 11063 |  				$out .= $comboenhancement; | 
                                                                                                            
                                                            | 11064 | 11064 |  				$morecss = 'minwidth200imp maxwidth500'; | 
                                                                                                            
                                                            | 11065 | 11065 |  			} | 
                                                                                                            
                                                            | 11066 | 11066 |   | 
                                                                                                            
                                                            | 11067 | 11067 |  			if (empty($option_only)) { | 
                                                                                                            
                                                            | 11068 |  | -				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 11068 | +				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 11069 | 11069 |  			} | 
                                                                                                            
                                                            | 11070 | 11070 |  			if (!empty($show_empty)) { | 
                                                                                                            
                                                            | 11071 | 11071 |  				$out .= '<option value="0" class="optiongrey">'; | 
                                                                                                                                                        
                                                        |  | @@ -11095,33 +11095,33 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11095 | 11095 |  						if ($showproject == 'all') { | 
                                                                                                            
                                                            | 11096 | 11096 |  							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref | 
                                                                                                            
                                                            | 11097 | 11097 |  							if ($obj->name) { | 
                                                                                                            
                                                            | 11098 |  | -								$labeltoshow .= ' - ' . $obj->name; // Soc name | 
                                                                                                            
                                                            |  | 11098 | +								$labeltoshow .= ' - '.$obj->name; // Soc name | 
                                                                                                            
                                                            | 11099 | 11099 |  							} | 
                                                                                                            
                                                            | 11100 | 11100 |   | 
                                                                                                            
                                                            | 11101 | 11101 |  							$disabled = 0; | 
                                                                                                            
                                                            | 11102 | 11102 |  							if ($obj->fk_statut == Project::STATUS_DRAFT) { | 
                                                                                                            
                                                            | 11103 | 11103 |  								$disabled = 1; | 
                                                                                                            
                                                            | 11104 |  | -								$labeltoshow .= ' - ' . $langs->trans("Draft"); | 
                                                                                                            
                                                            |  | 11104 | +								$labeltoshow .= ' - '.$langs->trans("Draft"); | 
                                                                                                            
                                                            | 11105 | 11105 |  							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { | 
                                                                                                            
                                                            | 11106 | 11106 |  								if ($discard_closed == 2) { | 
                                                                                                            
                                                            | 11107 | 11107 |  									$disabled = 1; | 
                                                                                                            
                                                            | 11108 | 11108 |  								} | 
                                                                                                            
                                                            | 11109 |  | -								$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                                                                            
                                                            |  | 11109 | +								$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                                                                            
                                                            | 11110 | 11110 |  							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { | 
                                                                                                            
                                                            | 11111 | 11111 |  								$disabled = 1; | 
                                                                                                            
                                                            | 11112 |  | -								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); | 
                                                                                                            
                                                            |  | 11112 | +								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); | 
                                                                                                            
                                                            | 11113 | 11113 |  							} | 
                                                                                                            
                                                            | 11114 | 11114 |  						} | 
                                                                                                            
                                                            | 11115 | 11115 |   | 
                                                                                                            
                                                            | 11116 | 11116 |  						if (!empty($selected) && $selected == $obj->rowid) { | 
                                                                                                            
                                                            | 11117 |  | -							$out .= '<option value="' . $obj->rowid . '" selected'; | 
                                                                                                            
                                                            |  | 11117 | +							$out .= '<option value="'.$obj->rowid.'" selected'; | 
                                                                                                            
                                                            | 11118 | 11118 |  							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled | 
                                                                                                            
                                                            | 11119 |  | -							$out .= '>' . $labeltoshow . '</option>'; | 
                                                                                                            
                                                            |  | 11119 | +							$out .= '>'.$labeltoshow.'</option>'; | 
                                                                                                            
                                                            | 11120 | 11120 |  						} else { | 
                                                                                                            
                                                            | 11121 | 11121 |  							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { | 
                                                                                                            
                                                            | 11122 | 11122 |  								$resultat = ''; | 
                                                                                                            
                                                            | 11123 | 11123 |  							} else { | 
                                                                                                            
                                                            | 11124 |  | -								$resultat = '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 11124 | +								$resultat = '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 11125 | 11125 |  								if ($disabled) { | 
                                                                                                            
                                                            | 11126 | 11126 |  									$resultat .= ' disabled'; | 
                                                                                                            
                                                            | 11127 | 11127 |  								} | 
                                                                                                                                                        
                                                        |  | @@ -11173,22 +11173,22 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11173 | 11173 |   | 
                                                                                                            
                                                            | 11174 | 11174 |  		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; | 
                                                                                                            
                                                            | 11175 | 11175 |  		//$sql.= ', el.fk_source'; | 
                                                                                                            
                                                            | 11176 |  | -		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; | 
                                                                                                            
                                                            | 11177 |  | -		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; | 
                                                                                                            
                                                            |  | 11176 | +		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; | 
                                                                                                            
                                                            |  | 11177 | +		$sql .= " WHERE f.entity IN (".getEntity('invoice').")"; | 
                                                                                                            
                                                            | 11178 | 11178 |  		$sql .= " ORDER BY f.titre ASC"; | 
                                                                                                            
                                                            | 11179 | 11179 |   | 
                                                                                                            
                                                            | 11180 | 11180 |  		$resql = $this->db->query($sql); | 
                                                                                                            
                                                            | 11181 | 11181 |  		if ($resql) { | 
                                                                                                            
                                                            | 11182 | 11182 |  			// Use select2 selector | 
                                                                                                            
                                                            | 11183 | 11183 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                                                                            
                                                            | 11184 |  | -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            |  | 11184 | +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; | 
                                                                                                            
                                                            | 11185 | 11185 |  				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); | 
                                                                                                            
                                                            | 11186 | 11186 |  				$out .= $comboenhancement; | 
                                                                                                            
                                                            | 11187 | 11187 |  				$morecss = 'minwidth200imp maxwidth500'; | 
                                                                                                            
                                                            | 11188 | 11188 |  			} | 
                                                                                                            
                                                            | 11189 | 11189 |   | 
                                                                                                            
                                                            | 11190 | 11190 |  			if (empty($option_only)) { | 
                                                                                                            
                                                            | 11191 |  | -				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 11191 | +				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 11192 | 11192 |  			} | 
                                                                                                            
                                                            | 11193 | 11193 |  			if (!empty($show_empty)) { | 
                                                                                                            
                                                            | 11194 | 11194 |  				$out .= '<option value="0" class="optiongrey">'; | 
                                                                                                                                                        
                                                        |  | @@ -11207,19 +11207,19 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11207 | 11207 |  					$disabled = 0; | 
                                                                                                            
                                                            | 11208 | 11208 |  					if (!empty($obj->suspended)) { | 
                                                                                                            
                                                            | 11209 | 11209 |  						$disabled = 1; | 
                                                                                                            
                                                            | 11210 |  | -						$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                                                                            
                                                            |  | 11210 | +						$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                                                                            
                                                            | 11211 | 11211 |  					} | 
                                                                                                            
                                                            | 11212 | 11212 |   | 
                                                                                                            
                                                            | 11213 | 11213 |   | 
                                                                                                            
                                                            | 11214 | 11214 |  					if (!empty($selected) && $selected == $obj->rowid) { | 
                                                                                                            
                                                            | 11215 |  | -						$out .= '<option value="' . $obj->rowid . '" selected'; | 
                                                                                                            
                                                            |  | 11215 | +						$out .= '<option value="'.$obj->rowid.'" selected'; | 
                                                                                                            
                                                            | 11216 | 11216 |  						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled | 
                                                                                                            
                                                            | 11217 |  | -						$out .= '>' . $labeltoshow . '</option>'; | 
                                                                                                            
                                                            |  | 11217 | +						$out .= '>'.$labeltoshow.'</option>'; | 
                                                                                                            
                                                            | 11218 | 11218 |  					} else { | 
                                                                                                            
                                                            | 11219 | 11219 |  						if ($disabled && ($selected != $obj->rowid)) { | 
                                                                                                            
                                                            | 11220 | 11220 |  							$resultat = ''; | 
                                                                                                            
                                                            | 11221 | 11221 |  						} else { | 
                                                                                                            
                                                            | 11222 |  | -							$resultat = '<option value="' . $obj->rowid . '"'; | 
                                                                                                            
                                                            |  | 11222 | +							$resultat = '<option value="'.$obj->rowid.'"'; | 
                                                                                                            
                                                            | 11223 | 11223 |  							if ($disabled) { | 
                                                                                                            
                                                            | 11224 | 11224 |  								$resultat .= ' disabled'; | 
                                                                                                            
                                                            | 11225 | 11225 |  							} | 
                                                                                                                                                        
                                                        |  | @@ -11264,14 +11264,14 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11264 | 11264 |  		$formother = new FormOther($this->db); | 
                                                                                                            
                                                            | 11265 | 11265 |   | 
                                                                                                            
                                                            | 11266 | 11266 |  		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with () | 
                                                                                                            
                                                            | 11267 |  | -			$search_component_params_hidden = '(' . $search_component_params_hidden . ')'; | 
                                                                                                            
                                                            |  | 11267 | +			$search_component_params_hidden = '('.$search_component_params_hidden.')'; | 
                                                                                                            
                                                            | 11268 | 11268 |  		} | 
                                                                                                            
                                                            | 11269 | 11269 |   | 
                                                                                                            
                                                            | 11270 | 11270 |  		$ret = ''; | 
                                                                                                            
                                                            | 11271 | 11271 |   | 
                                                                                                            
                                                            | 11272 | 11272 |  		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; | 
                                                                                                            
                                                            | 11273 | 11273 |  		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; | 
                                                                                                            
                                                            | 11274 |  | -		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; | 
                                                                                                            
                                                            |  | 11274 | +		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; | 
                                                                                                            
                                                            | 11275 | 11275 |  		$ret .= '</a>'; | 
                                                                                                            
                                                            | 11276 | 11276 |   | 
                                                                                                            
                                                            | 11277 | 11277 |  		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; | 
                                                                                                                                                        
                                                        |  | @@ -11315,30 +11315,30 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11315 | 11315 |  			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; | 
                                                                                                            
                                                            | 11316 | 11316 |  		} | 
                                                                                                            
                                                            | 11317 | 11317 |  		$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%')) -->"; | 
                                                                                                            
                                                            | 11318 |  | -		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; | 
                                                                                                            
                                                            |  | 11318 | +		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; | 
                                                                                                            
                                                            | 11319 | 11319 |  		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; | 
                                                                                                            
                                                            | 11320 | 11320 |   | 
                                                                                                            
                                                            | 11321 | 11321 |  		// TODO : Use $arrayoffiltercriterias instead of $arrayofcriterias | 
                                                                                                            
                                                            | 11322 | 11322 |  		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields | 
                                                                                                            
                                                            | 11323 | 11323 |  		foreach ($arrayofcriterias as $criteria) { | 
                                                                                                            
                                                            | 11324 | 11324 |  			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { | 
                                                                                                            
                                                            | 11325 |  | -				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                                                                            
                                                            |  | 11325 | +				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                                                                            
                                                            | 11326 | 11326 |  					continue; | 
                                                                                                            
                                                            | 11327 | 11327 |  				} | 
                                                                                                            
                                                            | 11328 | 11328 |  				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { | 
                                                                                                            
                                                            | 11329 | 11329 |  					continue; | 
                                                                                                            
                                                            | 11330 | 11330 |  				} | 
                                                                                                            
                                                            | 11331 | 11331 |  				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { | 
                                                                                                            
                                                            | 11332 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; | 
                                                                                                            
                                                            | 11333 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; | 
                                                                                                            
                                                            | 11334 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; | 
                                                                                                            
                                                            | 11335 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; | 
                                                                                                            
                                                            | 11336 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; | 
                                                                                                            
                                                            | 11337 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; | 
                                                                                                            
                                                            | 11338 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; | 
                                                                                                            
                                                            | 11339 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; | 
                                                                                                            
                                                            |  | 11332 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; | 
                                                                                                            
                                                            |  | 11333 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; | 
                                                                                                            
                                                            |  | 11334 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; | 
                                                                                                            
                                                            |  | 11335 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; | 
                                                                                                            
                                                            |  | 11336 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; | 
                                                                                                            
                                                            |  | 11337 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; | 
                                                                                                            
                                                            |  | 11338 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; | 
                                                                                                            
                                                            |  | 11339 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; | 
                                                                                                            
                                                            | 11340 | 11340 |  				} else { | 
                                                                                                            
                                                            | 11341 |  | -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; | 
                                                                                                            
                                                            |  | 11341 | +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; | 
                                                                                                            
                                                            | 11342 | 11342 |  				} | 
                                                                                                            
                                                            | 11343 | 11343 |  			} | 
                                                                                                            
                                                            | 11344 | 11344 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -11346,7 +11346,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11346 | 11346 |  		$ret .= '</div>'; | 
                                                                                                            
                                                            | 11347 | 11347 |   | 
                                                                                                            
                                                            | 11348 | 11348 |  		$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"; | 
                                                                                                            
                                                            | 11349 |  | -		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                                                                            
                                                            |  | 11349 | +		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                                                                            
                                                            | 11350 | 11350 |   | 
                                                                                                            
                                                            | 11351 | 11351 |  		$ret .= '</div>'; | 
                                                                                                            
                                                            | 11352 | 11352 |  		$ret .= '</div>'; | 
                                                                                                                                                        
                                                        |  | @@ -11403,7 +11403,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11403 | 11403 |  		// Convert $arrayoffiltercriterias into a json object that can be used in jquery to build the search component dynamically | 
                                                                                                            
                                                            | 11404 | 11404 |  		$arrayoffiltercriterias_json = json_encode($arrayoffiltercriterias); | 
                                                                                                            
                                                            | 11405 | 11405 |  		$ret .= '<script> | 
                                                                                                            
                                                            | 11406 |  | -			var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json . '; | 
                                                                                                            
                                                            |  | 11406 | +			var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json.'; | 
                                                                                                            
                                                            | 11407 | 11407 |  		</script>'; | 
                                                                                                            
                                                            | 11408 | 11408 |   | 
                                                                                                            
                                                            | 11409 | 11409 |   | 
                                                                                                                                                        
                                                        |  | @@ -11417,9 +11417,9 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11417 | 11417 |  		$ret .= '<div class="search-component-assistance">'; | 
                                                                                                            
                                                            | 11418 | 11418 |  		$ret .= '<div>'; | 
                                                                                                            
                                                            | 11419 | 11419 |   | 
                                                                                                            
                                                            | 11420 |  | -		$ret .= '<p class="assistance-title">' . img_picto('', 'filter') . ' ' . $langs->trans('FilterAssistance') . ' </p>'; | 
                                                                                                            
                                                            |  | 11420 | +		$ret .= '<p class="assistance-title">'.img_picto('', 'filter').' '.$langs->trans('FilterAssistance').' </p>'; | 
                                                                                                            
                                                            | 11421 | 11421 |   | 
                                                                                                            
                                                            | 11422 |  | -		$ret .= '<p class="assistance-errors error" style="display:none">' . $langs->trans('AllFieldsRequired') . ' </p>'; | 
                                                                                                            
                                                            |  | 11422 | +		$ret .= '<p class="assistance-errors error" style="display:none">'.$langs->trans('AllFieldsRequired').' </p>'; | 
                                                                                                            
                                                            | 11423 | 11423 |   | 
                                                                                                            
                                                            | 11424 | 11424 |  		$ret .= '<div class="operand">'; | 
                                                                                                            
                                                            | 11425 | 11425 |  		$ret .= $form->selectarray('search_filter_field', $arrayoffilterfieldslabel, '', $langs->trans("Fields"), 0, 0, '', 0, 0, 0, '', 'width250', 1); | 
                                                                                                                                                        
                                                        |  | @@ -11433,7 +11433,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11433 | 11433 |  		$ret .= '</select>'; | 
                                                                                                            
                                                            | 11434 | 11434 |  		$ret .= '<script>$(document).ready(function() {'; | 
                                                                                                            
                                                            | 11435 | 11435 |  		$ret .= '   $(".operator-selector").select2({'; | 
                                                                                                            
                                                            | 11436 |  | -		$ret .= '       placeholder: \'' . dol_escape_js($langs->trans('Operator')) . '\''; | 
                                                                                                            
                                                            |  | 11436 | +		$ret .= '       placeholder: \''.dol_escape_js($langs->trans('Operator')).'\''; | 
                                                                                                            
                                                            | 11437 | 11437 |  		$ret .= '   });'; | 
                                                                                                            
                                                            | 11438 | 11438 |  		$ret .= '});</script>'; | 
                                                                                                            
                                                            | 11439 | 11439 |  		$ret .= '</div>'; | 
                                                                                                                                                        
                                                        |  | @@ -11442,12 +11442,12 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11442 | 11442 |   | 
                                                                                                            
                                                            | 11443 | 11443 |  		$ret .= '<div class="value">'; | 
                                                                                                            
                                                            | 11444 | 11444 |  		// Input field for entering values | 
                                                                                                            
                                                            | 11445 |  | -		$ret .= '<input type="text" class="flat width100 value-input" placeholder="' . dolPrintHTML($langs->trans('Value')) . '">'; | 
                                                                                                            
                                                            |  | 11445 | +		$ret .= '<input type="text" class="flat width100 value-input" placeholder="'.dolPrintHTML($langs->trans('Value')).'">'; | 
                                                                                                            
                                                            | 11446 | 11446 |   | 
                                                                                                            
                                                            | 11447 | 11447 |  		// Date selector | 
                                                                                                            
                                                            | 11448 | 11448 |  		$dateOne = ''; | 
                                                                                                            
                                                            | 11449 | 11449 |  		$ret .= '<span class="date-one" style="display:none">'; | 
                                                                                                            
                                                            | 11450 |  | -		$ret .=  $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, ''); | 
                                                                                                            
                                                            |  | 11450 | +		$ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, ''); | 
                                                                                                            
                                                            | 11451 | 11451 |  		$ret .= '</span>'; | 
                                                                                                            
                                                            | 11452 | 11452 |   | 
                                                                                                            
                                                            | 11453 | 11453 |  		// Value selector (will be populated dynamically) based on search_filter_field value if a selected value has an array of values | 
                                                                                                                                                        
                                                        |  | @@ -11456,7 +11456,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11456 | 11456 |  		$ret .= '<script> | 
                                                                                                            
                                                            | 11457 | 11457 |  			$(document).ready(function() { | 
                                                                                                            
                                                            | 11458 | 11458 |  				$("#value-selector").select2({ | 
                                                                                                            
                                                            | 11459 |  | -					placeholder: "' . dol_escape_js($langs->trans('Value')) . '" | 
                                                                                                            
                                                            |  | 11459 | +					placeholder: "' . dol_escape_js($langs->trans('Value')).'" | 
                                                                                                            
                                                            | 11460 | 11460 |  				}); | 
                                                                                                            
                                                            | 11461 | 11461 |  				$("#value-selector").hide(); | 
                                                                                                            
                                                            | 11462 | 11462 |  				$("#value-selector").next(".select2-container").hide(); | 
                                                                                                                                                        
                                                        |  | @@ -11466,7 +11466,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11466 | 11466 |  		$ret .= '</div>'; | 
                                                                                                            
                                                            | 11467 | 11467 |   | 
                                                                                                            
                                                            | 11468 | 11468 |  		$ret .= '<div class="btn-div">'; | 
                                                                                                            
                                                            | 11469 |  | -		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">' . $langs->trans("addToFilter") . '</button>'; | 
                                                                                                            
                                                            |  | 11469 | +		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">'.$langs->trans("addToFilter").'</button>'; | 
                                                                                                            
                                                            | 11470 | 11470 |  		$ret .= '</div>'; | 
                                                                                                            
                                                            | 11471 | 11471 |   | 
                                                                                                            
                                                            | 11472 | 11472 |  		$ret .= '</div>'; | 
                                                                                                                                                        
                                                        |  | @@ -11632,7 +11632,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11632 | 11632 |   | 
                                                                                                            
                                                            | 11633 | 11633 |  		$TModels = array(); | 
                                                                                                            
                                                            | 11634 | 11634 |   | 
                                                                                                            
                                                            | 11635 |  | -		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; | 
                                                                                                            
                                                            |  | 11635 | +		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; | 
                                                                                                            
                                                            | 11636 | 11636 |  		$formmail = new FormMail($this->db); | 
                                                                                                            
                                                            | 11637 | 11637 |  		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); | 
                                                                                                            
                                                            | 11638 | 11638 |   | 
                                                                                                                                                        
                                                        |  | @@ -11645,20 +11645,20 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11645 | 11645 |  			} | 
                                                                                                            
                                                            | 11646 | 11646 |  		} | 
                                                                                                            
                                                            | 11647 | 11647 |   | 
                                                                                                            
                                                            | 11648 |  | -		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; | 
                                                                                                            
                                                            |  | 11648 | +		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; | 
                                                                                                            
                                                            | 11649 | 11649 |   | 
                                                                                                            
                                                            | 11650 | 11650 |  		foreach ($TModels as $id_model => $label_model) { | 
                                                                                                            
                                                            | 11651 |  | -			$retstring .= '<option value="' . $id_model . '"'; | 
                                                                                                            
                                                            |  | 11651 | +			$retstring .= '<option value="'.$id_model.'"'; | 
                                                                                                            
                                                            | 11652 | 11652 |  			if (!empty($selected) && $selected == $id_model) { | 
                                                                                                            
                                                            | 11653 | 11653 |  				$retstring .= "selected"; | 
                                                                                                            
                                                            | 11654 | 11654 |  			} | 
                                                                                                            
                                                            | 11655 |  | -			$retstring .= ">" . $label_model . "</option>"; | 
                                                                                                            
                                                            |  | 11655 | +			$retstring .= ">".$label_model."</option>"; | 
                                                                                                            
                                                            | 11656 | 11656 |  		} | 
                                                                                                            
                                                            | 11657 | 11657 |   | 
                                                                                                            
                                                            | 11658 | 11658 |  		$retstring .= "</select>"; | 
                                                                                                            
                                                            | 11659 | 11659 |   | 
                                                                                                            
                                                            | 11660 | 11660 |  		if ($addjscombo) { | 
                                                                                                            
                                                            | 11661 |  | -			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); | 
                                                                                                            
                                                            |  | 11661 | +			$retstring .= ajax_combobox('select_'.$prefix.'model_mail'); | 
                                                                                                            
                                                            | 11662 | 11662 |  		} | 
                                                                                                            
                                                            | 11663 | 11663 |   | 
                                                                                                            
                                                            | 11664 | 11664 |  		return $retstring; | 
                                                                                                                                                        
                                                        |  | @@ -11709,16 +11709,16 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11709 | 11709 |   | 
                                                                                                            
                                                            | 11710 | 11710 |  		foreach ($buttons as $button) { | 
                                                                                                            
                                                            | 11711 | 11711 |  			$addclass = empty($button['addclass']) ? '' : $button['addclass']; | 
                                                                                                            
                                                            | 11712 |  | -			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->transnoentities($button['label_key'])) . '">'; | 
                                                                                                            
                                                            |  | 11712 | +			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->transnoentities($button['label_key'])).'">'; | 
                                                                                                            
                                                            | 11713 | 11713 |  		} | 
                                                                                                            
                                                            | 11714 | 11714 |  		$retstring .= $withoutdiv ? '' : '</div>'; | 
                                                                                                            
                                                            | 11715 | 11715 |   | 
                                                                                                            
                                                            | 11716 | 11716 |  		if ($dol_openinpopup) { | 
                                                                                                            
                                                            | 11717 |  | -			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n"; | 
                                                                                                            
                                                            | 11718 |  | -			$retstring .= '<script nonce="' . getNonce() . '">'; | 
                                                                                                            
                                                            |  | 11717 | +			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n"; | 
                                                                                                            
                                                            |  | 11718 | +			$retstring .= '<script nonce="'.getNonce().'">'; | 
                                                                                                            
                                                            | 11719 | 11719 |  			$retstring .= 'jQuery(".button-cancel").click(function(e) { | 
                                                                                                            
                                                            | 11720 |  | -				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\'); | 
                                                                                                            
                                                            | 11721 |  | -				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\'); | 
                                                                                                            
                                                            |  | 11720 | +				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\'); | 
                                                                                                            
                                                            |  | 11721 | +				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\'); | 
                                                                                                            
                                                            | 11722 | 11722 |  				 });'; | 
                                                                                                            
                                                            | 11723 | 11723 |  			$retstring .= '</script>'; | 
                                                                                                            
                                                            | 11724 | 11724 |  		} | 
                                                                                                                                                        
                                                        |  | @@ -11747,7 +11747,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11747 | 11747 |  		dol_syslog(__METHOD__, LOG_DEBUG); | 
                                                                                                            
                                                            | 11748 | 11748 |   | 
                                                                                                            
                                                            | 11749 | 11749 |  		$sql = "SELECT rowid, code, label as label"; | 
                                                                                                            
                                                            | 11750 |  | -		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; | 
                                                                                                            
                                                            |  | 11750 | +		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; | 
                                                                                                            
                                                            | 11751 | 11751 |  		$sql .= " WHERE active = 1"; | 
                                                                                                            
                                                            | 11752 | 11752 |   | 
                                                                                                            
                                                            | 11753 | 11753 |  		$resql = $this->db->query($sql); | 
                                                                                                                                                        
                                                        |  | @@ -11758,7 +11758,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11758 | 11758 |  				$obj = $this->db->fetch_object($resql); | 
                                                                                                            
                                                            | 11759 | 11759 |   | 
                                                                                                            
                                                            | 11760 | 11760 |  				// If translation exists, we use it, otherwise we take the default wording | 
                                                                                                            
                                                            | 11761 |  | -				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                                                                            
                                                            |  | 11761 | +				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                                                                            
                                                            | 11762 | 11762 |  				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; | 
                                                                                                            
                                                            | 11763 | 11763 |  				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; | 
                                                                                                            
                                                            | 11764 | 11764 |  				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; | 
                                                                                                                                                        
                                                        |  | @@ -11790,18 +11790,18 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 11790 | 11790 |  		global $langs, $user; | 
                                                                                                            
                                                            | 11791 | 11791 |   | 
                                                                                                            
                                                            | 11792 | 11792 |  		$out = ''; | 
                                                                                                            
                                                            | 11793 |  | -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            |  | 11793 | +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); | 
                                                                                                            
                                                            | 11794 | 11794 |   | 
                                                                                                            
                                                            | 11795 | 11795 |  		$this->load_cache_invoice_subtype(); | 
                                                                                                            
                                                            | 11796 | 11796 |   | 
                                                                                                            
                                                            | 11797 |  | -		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; | 
                                                                                                            
                                                            |  | 11797 | +		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; | 
                                                                                                            
                                                            | 11798 | 11798 |  		if ($addempty) { | 
                                                                                                            
                                                            | 11799 | 11799 |  			$out .= '<option value="0"> </option>'; | 
                                                                                                            
                                                            | 11800 | 11800 |  		} | 
                                                                                                            
                                                            | 11801 | 11801 |   | 
                                                                                                            
                                                            | 11802 | 11802 |  		foreach ($this->cache_invoice_subtype as $rowid => $subtype) { | 
                                                                                                            
                                                            | 11803 | 11803 |  			$label = $subtype['label']; | 
                                                                                                            
                                                            | 11804 |  | -			$out .= '<option value="' . $subtype['rowid'] . '"'; | 
                                                                                                            
                                                            |  | 11804 | +			$out .= '<option value="'.$subtype['rowid'].'"'; | 
                                                                                                            
                                                            | 11805 | 11805 |  			if ($selected == $subtype['rowid']) { | 
                                                                                                            
                                                            | 11806 | 11806 |  				$out .= ' selected="selected"'; | 
                                                                                                            
                                                            | 11807 | 11807 |  			} |